3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $data = [ 0 => 'john', 1 => 'robinson', 2 => '27-08-1980', 3 => 'football', 4 => 'pizza', ]; $template = "{0} {1} birthday {2} <br /> Hobbie : {3} <br /> favorite : {4}"; $string = reg_replace_callback( '/\{(\d+)\}/', function ($matches) use ($data) { var_dump($matches); return $matches[0]; }, $template ); echo $string;
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Call to undefined function reg_replace_callback() in /in/aQLov:13 Stack trace: #0 {main} thrown in /in/aQLov on line 13
Process exited with code 255.
Output for 5.4.1 - 5.6.28
Fatal error: Call to undefined function reg_replace_callback() in /in/aQLov on line 13
Process exited with code 255.
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/aQLov on line 3
Process exited with code 255.