3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $string = "/companies/(\d+)/adverts/new/(\d+)"; $replace = array(2223, 'generic'); $result = preg_replace_callback('#'.$string.'#', function($m) use $replace { return 'h'; }, $string); var_dump($result);
Output for 5.4.0 - 5.4.26
Parse error: syntax error, unexpected '$replace' (T_VARIABLE), expecting '(' in /in/35sA3 on line 6
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_VARIABLE, expecting '(' in /in/35sA3 on line 6
Process exited with code 255.