Skip to content
Advertisement

Deleting rows in callback function in array_walk()

I’m trying to work with array using array_walk() function such way:

JavaScript

Get:

JavaScript

It seems, what after deletion of 2nd element — 3rd element don’t be sended to callback function.

Advertisement

Answer

What you can do is use a secondary array, which will give the effect that those nodes have been deleted, like;

JavaScript

https://eval.in/206159

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement