I have the following array:
$people['men'] = [
'first_name' => 'John',
'last_name' => 'Doe'
];
And I have the following flat array:
$name = ['men', 'first_name'];
Now I want to create a function that "reads" the flat array and gets the value from the multidimensional array, based on the sequence of the elements of the flat array.
function read($multidimensionalArray,$flatArray){
// do stuff here
}
echo read($people,$name); // must print 'John'
Is this even possible to achieve? And which way is the way to go with it? I'm really breaking my head over this. I have no clue at all how to start.
Thanks in advance.