So I have arrays of different lengths
pathes= array(array('f1e9'),
array('c0d9', '0', 'form_values', '6e13')
);
For each path I would like to use each value as an index to scan a separate array.
foreach ($pathes as $key => $val){
$new_path = '$array_to_search';
foreach ($val as $index){
$newpath .= '[' . $index . ']';
}
}
So within the loop the $new_path variable would be a string that looked like:
$new_path = '$array_to_search['f1e9']'
and
$new_path = '$array_to_search['c0d9']['0']['form_values']['6e13']'
But then I would have to be able to evaluate this string, and I do not know how to do this.
I think the answer might lie somewhere in variable variables, but I am not sure how to go about this.
Sincere thanks for any help. It is greatly appreciated!