- var_dump: documentation ( source)
- preg_replace_callback: documentation ( source)
<?php
$string = 'abc';
var_dump(preg_replace_callback(
'/(.)/',
function ($m) {
static $counter = 1;
return 'foo' . $counter++;
},
$string
));