@ 2015-09-24T11:55:03Z <?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;
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 7.0.0 - 7.0.20 , 7.1.0 - 7.1.20 , 7.2.0 - 7.2.33 , 7.3.16 - 7.3.33 , 7.4.0 - 7.4.33 , 8.0.0 - 8.0.30 , 8.1.0 - 8.1.27 , 8.2.0 - 8.2.17 , 8.3.0 - 8.3.4 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.4.45 , 5.5.24 - 5.5.35 , 5.6.8 - 5.6.28 Fatal error: Call to undefined function reg_replace_callback() in /in/aQLov on line 13
Process exited with code 255 . preferences:dark mode live preview
173.21 ms | 402 KiB | 223 Q