Re: nested array...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, December 17, 2007 8:48 am, opo jal wrote:
> hi, i have a nested array
> ex:
> 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..

I would have built the arrays with the ID as the index in the first
place, and then used http://php.net/isset, but maybe that's just me...

You could mess with in_array I suspect, or write an array_map that
stores the ID when you hit it...

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux