string_replace [function]
string_replace( string str, string from, string to )
string_replace( string str, array from, string to )
string_replace( string str, array from, array to )
replaces parts of string str
, specified in from
, to the respective values passed in to
- the respective replacement is picked by taking the substring index and performing modulo operation with the number of replacement strings
string_replace( "loaded %num files", "%num", 5 ); // string [14] "loaded 5 files"
string_replace( "abcd", ["a","b","c","d"], [1,2,3,4] ); // string [4] "1234"
string_replace( "1234", ["1","2","3","4"], ["x","y"] ); // string [4] "xyxy"