How can I replace part of a string, when that part and the replacement both include special characters? e.g.
$text = "|123|12|12|";
$text = preg_replace("|0|","|12|",$text, 1);
echo($text);
Desired output: "|123|0|12|"
The special characters don't matter as long as they are preserved. E.g.
$text = "#123#12#12#";
$text = preg_replace("#0#","#12#",$text, 1);
echo($text);
Desired output: "#123#0#12#"
Any ideas?