fork download
  1. <?php
  2. $string = 'aaa xxxxxxxxxxxxxxxxxxxx 000';
  3. $patterns = array();
  4. $patterns[0] = '/000/';
  5.  
  6. $replacements = array();
  7. $replacements[2] = '111';
  8.  
  9. echo preg_replace($patterns, $replacements, $string);
  10. ?>
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
aaa xxxxxxxxxxxxxxxxxxxx 111