How to replace string in Php ?

Question

How to replace string in Php ?

Re: How to replace string in Php ?

Another key tool to have in your programming toolbox is the ability to quickly replace parts of a PHP string with new
values. The str_replace function is similar to a word processor's "Replace All" command that lets you specify a word and
what to replace it with, then replaces every occurrence of that word in the document.
str_replace Parameters
str_replace has three parameters that are required for the function to work properly. str_replace(search, replace,
originalString).
1. search - This is what you want to search your string for. This can be a string or an array.
2. replace - All matches for search will be replaced with this value. This can be a string or an array.
3. originalString - This is what search and replace will be operating on. The str_replace function will return a
modified version of originalString when it completes.