I’m looking for a nice way of doing the magicFunction():
$indexes = array(1, 3, 0);
$multiDimensionalArray = array(
'0',
array('1-0','1-1','1-2',array('2-0','2-1','2-2')),
array('1-4','1-5','1-6')
);
$result = magicFunction($indexes, $multiDimensionalArray);
// $result == '2-0', like if we did $result = $multiDimensionalArray[1][3][0];
Thanks.
My own attempt ; found it simpler by not doing it recursively, finally.
Exceptions may be somewhat “violent” here, but at least you can know exactly what’s going on when necessary.
Maybe, for sensitive hearts, a third
$defaultValueoptional parameter could allow to provide a fallback value if one of the indexes isn’t found.