Use array_map recursively instead of mutating array_walk thanks @igorw