PHP preg_replace without eval
- by Alec Smart
Am trying to use something like:
$newdata = preg_replace($pattern, $replacement, $data);
Now my replacement is something like
$pattern = "/START(.*?)END/is";
$replacement = "START $config END";
Now, $config contains contents like
array('Test\\\'s Page')
The problem is that after I write the content, $newdata becomes
START array('Test\\'s Page') END
As you see above a single \ goes missing because it gets evaluated. How do I avoid that?