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