Re: nested array...

From: Date: Mon, 17 Dec 2007 16:17:58 +0000
Subject: Re: nested array...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-265983@lists.php.net to get a copy of this message
print_r($nestedarray): Array( [0]=>Array([id]=>1 [name]=>name1 [etc]=>etc1) [1]=>Array([id]=>2 [name]=>name2 [etc]=>etc2) [3]=>Array([id]=>3 [name]=>name3 [etc]=>etc3) ) if I want to check whether id=5 is in that $nestedarray, how to do that?!?! i'd really appreciate the help..
<?php
    foreach ($nestedarray as $v) {
if ($v['id'] == 5) {
            $in_array = true;
            break;
        }
    }
?> -- Richard Heyes http://www.websupportsolutions.co.uk Knowledge Base and HelpDesk software that can cut the cost of online support ** NOW OFFERING FREE ACCOUNTS TO CHARITIES AND NON-PROFITS **

« previous php.general (#265983) next »