PHP: How to retrieve the parent array dimension having child -


i want create function pass parameter array "position", this:

function f($pos){}; f($people[all][person][name]); 

then want retrieve parent dimension of array, want have $people[all]. way foreach cycle on person.

my idea function pass position , function sort "parent" dimension position given.

common case:

$people[men][person][name]=>value f($people[men][person][name]) 

will sort men name.

how that?

how

function f($pos){ foreach ($people[all][person] $name){ echo $name; }  } f($people); 

this name


Comments

Popular posts from this blog

unix - grep command not match start of new line with another regex -

sql - calculate weighted average for each day and id based on time intervals in PostgreSQL -

Sort a complex associative array in PHP -