$string = '20110306';
$pattern = '(\d{6})(\d{2})';
$replacement = '$101';
echo preg_replace($pattern, $replacement, $string);
I want it to echo 20110301
I used http://gskinner.com/RegExr/ to come up with the search and replacement pattern, maybe I am missing something when it comes to replacing the found pattern.
It gives me the following warning:
Message: preg_replace() [function.preg-replace]: Unknown modifier '('