[PHP] in_array() with multidimensional array

2001-03-09 Thread Christian Dechery
How can I check if a value is in a multidimensional array? like I have ?php $i=0; while($idt = mssql_fetch_row($query_result)) { //echo $idt[0]."br"; $produtos_sem_tracking[$i]['cod']=$idt[0]; $produtos_sem_tracking[$i]['idt']=$idt[1];

Re: [PHP] in_array() with multidimensional array

2001-03-09 Thread Chris Lee
recusrion is your friend. ?php $test[0][0] = 'a'; $test[0][1] = 'b'; $test[0][2] = 'c'; $test[1][0] = 'd'; $test[1][1] = 'e'; $test[1][2] = 'f'; $test[2][0] = 'g'; $test[2][1] = 'h'; $test[2][2] = 'i'; function in_multi_array($needle, $haystack) { foreach($haystack as $pos = $val)