$array = [
'a' =>
[
'b' => [
'c' => 1,
'd' => 2
]
]
];
function get(array $array, string $keys)
{
$keys = explode('.', $keys);
if (count($keys) === 1) {
return $array[end($keys)];
} else {
$nextKey = array_shift($keys);
return get($array[$nextKey], implode('.', $keys));
}
}
echo get($array, 'a.b.c');