Tech

En till Good Old Blogs webbplats

On the uselessness of array_merge_recursive()

I guess that most people have run afoul of the monstrosity that is array_merge_recursive(). In short a merge of array(‘a’=>2, ‘b’=>3) and array(‘b’=>4) gives you array(‘a’=>2,’b’=>array(3,4)) which isn’t the result that one would expect. So, as usual, I’ve created a gist that outlines the problem and gives a more sensible alternative. http://gist.github.com/271920

Läs mer