If search is an array replace is a string then this replacement string is used for every value of search. This includes any functionality requiring access at a specific index, since random access is not possible in a string whose number. If replace has fewer values than search, then an empty string is used for the rest of replacement values. Php manual string replace. If search uses them to search , replace are arrays, then str_ replace( ) takes a value from each array replace on subject. Note that some of the multi- byte functions run in O( n) time, rather than constant time as is the case for their single- byte equivalents.
If search is an array and replace is a string, then this replacement string is used for every value of search. substr_ replace( ) replaces a copy of string delimited by the start and ( optionally) length parameters with the string given in replacement.