Page 1 of 1

Searching nested array

Posted: Fri Apr 11, 2008 5:43 am
by aceconcepts
Hi,

I have been able to add to my array using the following method:

Code: Select all

 
$_SESSION['selectedStageQuestions'][$key][$stage][]=$value;
 
Now what I want to be able to do is search the third nested array (shown above).

How would I use in_array() or other function to search that third array?

Thanks.

Re: Searching nested array

Posted: Fri Apr 11, 2008 5:59 am
by EverLearning

Code: Select all

in_array($searchingFor, $_SESSION['selectedStageQuestions'][$key][$stage])

Re: Searching nested array

Posted: Fri Apr 11, 2008 7:21 am
by aceconcepts
Yeh, this is what I thought. I tried this before but it didnt work.

I'll have to go back and re-think.