In the str_replace
manual for PHP it states the following:
Because
str_replace()
replaces left to right, it might replace a previously inserted value when doing multiple replacements. See also the examples in this document.
Is there an equivalent function that does not have this gotcha or how can I safely do this?