fork(1) download
  1. <?php
  2. $input = array("foobar" => "Some other string");
  3.  
  4. $regex = '~GET:([a-zA-Z0-9_]+)~';
  5. $string = "foobar: GET:foobar";
  6. $string = preg_replace_callback($regex,
  7. function($matches) use ($input) {
  8. return $input[$matches[1]];
  9. },
  10. $string);
  11. echo $string;
  12. ?>
Success #stdin #stdout 0.02s 52472KB
stdin
Standard input is empty
stdout
foobar: Some other string