Re: [PHP] Get all the keys from a hierarchical hash

2011-06-24 Thread Fatih P.
use recursive calls to fetch them all in one array and there will be memory cost. refer array_keys function: http://php.net/manual/en/function.array-keys.php not sure but this should be working. function *get_keys_recursive*($arr) { while (list($k, $v) = each($arr)) { if (is_array($v)

[PHP] Get all the keys from a hierarchical hash

2011-06-23 Thread Scott Baker
I have a multi-tier hash (see below) and I'd like to be search the hash for a given $id, and return that section, regardless of how many layers deep it is. Sort of like how xpath works? Once I have that I'd like get ALL the children of a given node. So I could ask for 86, and get 36, 38, 56, etc