For substitution of entire passages used during the function str_replace (), which takes three parameters: the string to be swapped, a sequence which is to be swapped and a string of excerpts of which will be swapped.
All of the first string in the third over are converted to the second string.
The variable specified as the third parameter is not changed. Updated string is returned by the function.
$text = „If you raise your hand against”;
$result = str_replace („for”, „against”, $text);
$result variable will contain the text „If you’re against raise your hand.”
Each of the parameters of the function str_replace can be an array. If the third parameter is an array, the operation text substitution is performed on each element in the array and returns the variable is also an array. However, if boards are the first and the second parameter, each element of the first array is swapped for the corresponding element of the second array. If the first array has more elements than the other, these elements of the first array that have no counterpart in the other are converted to empty strings. This allows for multiple replacements in one function call str_replace.