Skip to content
Advertisement

Delete element from multidimensional-array based on value

I’m trying to delete elements from a multidimensional-array based on a value. In this case if a sub-array’s key ‘year’ has the value 2011 I want that sub-array out.

Just for the record: i’m running PHP 5.2.

My array looks like this:

JavaScript

Advertisement

Answer

Try this:

JavaScript

Then you would call it like this:

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