Bulk array searching

Ask about a PHP problem here.
Post Reply
User avatar
FrederickGeek8
Posts: 148
Joined: Wed Nov 30, 2011 10:31 pm

Bulk array searching

Post by FrederickGeek8 »

I am trying to create a simple function to validate a query. A query is invalid if in this array, the 3rd to the 10th index are set to N/A. I could is a if statement like this:
if($array[3] === 'N/A' && $array[4] === 'N/A', etc...)
is there any better way to "bulk" search an array? Maybe something where I could give it a range or something.

Thanks,
Fred

EDIT: I was able to do it using:
if(array_keys($array, "N/A") === range(3, 10))
Post Reply