functions-online

Comments

Last comments of user Florian [www]

On 24. Jun 2014 18:58 Florian wrote at preg_replace:

Nice tool, good job :) One small remark though. If you try to use backreference it wont work as you'd expect, here is the code generated for these values: $pattern => /the (dog|rat|duck) is ill/ $replacement => A \${1} is running $subject => the dog is ill preg_replace('/the (dog|rat|duck) is ill/', 'A \\${1} is running', 'the dog is ill', -1, $count); It fails because the $replacement (i.e 'A \\${1} is running') is set between simple quotes and not double quotes, also because of the backslash added.