You don't need sequential numbers as your key. Take this example: /*** define some values ***/ $fruits['apple']['color']=$color; $fruits['apple']['diameter']=$x; $fruits['orange']['color']=$color; $fruits['orange']['diameter']=$x; $fruits['grape']['color']=$color; $fruits['grape']['diameter']=$x;
/*** Grab the keys ***/ $fruit_types = array_keys($fruits); $count = 0; while ($count < count($fruit_types)) { $fruit = $fruit_types[$count]; $color = $fruits[$fruit]['color']; $diameter = $fruits[$fruit]['diameter']; } Matt ----- Original Message ----- From: Mako Shark <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, November 28, 2002 3:45 PM Subject: Re: [PHP] Multidimensional arrays (more and more...) > <<if [$number] is unique, use it as the key:>> > > Yeah, I'd thought of that except there's no guarantee > that it will be unique. > > Plus, it makes it harder to go through with a simple > loop because $number really isn't guaranteed to be > numeric (okay, so I have to change the name). Plus, it > may not even start from 0, For instance, it doesn't > have to be from 1-10, it could be from 75-85. > > > > __________________________________________________ > Do you Yahoo!? > Yahoo! Mail Plus - Powerful. Affordable. Sign up now. > http://mailplus.yahoo.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php