How can I replace a sub string with some other string for all items of an array in PHP?
I don\'t want to use a loop to do it. Is there a predefined function in PHP t
I am not sure how efficient this is, but I wanted to replace strings in a big multidimensional array and did not want to loop through all items as the array structure is pretty dynamic.
I first json_encode the array into a string.
Replace all the strings I want (need to use preg_replace if there are non-English characters that get encoded by json_encode).
json_decode to get the array back.