troubleshooting Question

array_filter on multidimensional array in PHP

Avatar of Lupi05
Lupi05 asked on
5 Comments1 Solution2865 ViewsLast Modified:
Hi experts,

I have a twodimensional array like so:


The array uses numeric indexes, so

$myarray[3][2] would be "13.99" and $myarray[0][1] would be "green".

Now I want to use array_filter to only get the 2nd dimension arrays which are "black".

So what I need to do is check whether $myarray[x][1] == "black". And then check the whole array.

I can't wrap my head around the callback function for the array_filter... How do I check the array?

Thanks, Chris
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 5 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros