Invalid line:
$code = preg_replace('/{([0-9]+)}/', 'test($1)', $code);
How it works:
{match a literal {
(start a capturing group
[0-9] + one or more digits in 0-9
) end the capturing group
} match a literal}
$ 1 in the replacement line refers to the line captured by the first (and only) capture group.
source share