Skip to content
Advertisement

Tag: pass-by-reference

How can I recursively search for and replace values inside of an unknown-depth multidimensional PHP array?

I’m working with a JSON string. I’m converting it to an associative array to find specific values and change those values when a certain key is found ([‘content’]). The depth of the array is always unknown and will always vary. Here is the function I wrote. It takes an array as an argument and passes it by reference so that

Advertisement