search an array
Posted on 2013-01-21
Hi there, can't seem to find exactly what I'm looking for to search a array and produce the results I need. Let's say I have an array that that has the following.
User Number Color
Bill 1 Blue
Scott 2 Yellow
Jill 3 Green
Bob 1 Purple
I know if a person has Number '1' color should be 'Blue', and '2' should be yellow, and '3' should be green. What I want to find are the elements that aren't matching what I expect to see. So I need to search the array above and I would expect to see Bob, 1, purple.
I know I could create a foreach loop with some else and elseif statements, but is there a simpler way I could accomplish the same by piping the array through some search filter?
Thanks in advance for any suggestions.