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)
{
if (is_array($val))
{
if (in_multi_array($needle, $val))
return 1;
} else
if ($val == $needle)
return 1;
}
}
if (in_multi_array('d', $test))
echo "TRUE <br>\n";
else
echo "FALSE <br>\n";
?>
--
Chris Lee
Mediawaveonline.com
ph. 250.377.1095
ph. 250.376.2690
fx. 250.554.1120
[EMAIL PROTECTED]
""Christian Dechery"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
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];
$produtos_sem_tracking[$i]['gen']=$idt[2];
}
?>
how can I check for an existing $produtos_sem_tracking['cod'] value for
example?
. [ Christian Dechery ]
. Webdeveloper @ Tá Na Mesa!
. Listmaster @ Gaita-L
. http://www.tanamesa.com.br
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]