PHP: Accessing child arrays when you don't know the parent's keys and you can't just search for the value needed -
PHP: Accessing child arrays when you don't know the parent's keys and you can't just search for the value needed -
i have php array containing film descriptions ($descriptions) , php array containing showtimes , ticket quantities ($stock) movies. each unique film id in $descripctions, need of showtimes , tickets $stock.
is there no built-in php function search unique id , homecoming chain of keys needed access value? can't find elegant solution after total day of googling , reviewing every array function in php manual twice.
if there's no more elegant solution, best approach custom recursive function? if so, guidance on best approach / command structure? maybe counting array elements , using several levels of while loops go through each level of array?
here's origin of $stock array i'm trying info -- won't post entire print_r() because source array on 67,000 lines long much should indicate construction i'm working with.
thank much!!!
array ( [products] => array ( [venue] => array ( [0] => array ( [title] => 3-d digital cinema [length] => 25 [memberonly] => 0 [shows] => array ( [show] => array ( [0] => array ( [title] => planet [location] => 3-d digital cinema [eventnumber] => 521 [date] => array ( [0] => array ( [eventdate] => 2012/01/01 [times] => array ( [time] => array ( [0] => array ( [starttime] => 13:00:00 [instock] => 110 ) [1] => array ( [starttime] => 16:00:00 [instock] => 110 ) ) ) ) [1] => array ( [eventdate] => 2012/01/02 [times] => array ( [time] => array ( [0] => array ( [starttime] => 13:00:00 [instock] => 110 ) [1] => array ( [starttime] => 16:00:00 [instock] => 110 ) ) ) )
php arrays
Comments
Post a Comment