I\'m trying to find (or create) a function. I have a multidimensional array:
$data_arr = [
\"a\" => [
\"aa\" => \"abfoo\",
\"ab\"
You need a function like this:
function getValue($data_arr, $data_arr_call) {
foreach ($data_arr_call as $index) {
if (isset($data_arr[$index])) {
$data_arr = $data_arr[$index];
} else {
return false;
}
}
return $data_arr;
}
And use it like this:
$data_arr = [
"a" => [
"ab" => [
"abc" => "abbfoo",
],
],
];
$data_arr_call = ["a", "ab", "abc"];
$value = getValue($data_arr, $data_arr_call);
if ($value) {
// do your stuff
}