In Online Document say's:
Users may not change the array itself from the callback function. e.g.
Add/delete elements, unset elements, etc. If the array that
array_walk() is applied to is changed, the behavior of this function
is undefined, and unpredictable.
So I'm use Use Optional param( [,
This might be better served by taking it to php-general, because I don't
think you need to pin your question so hard to the behaviour of
array_walk(). Here's a quick example of (if I understood your question
correctly) how you might solve it using array_udiff_uassoc and 5.3's new
'closure' syntax