- print_r: documentation ( source)
- explode: documentation ( source)
<?php
$testArray = array(
'router' => array(
'format' => 'xml',
),
);
$path = 'router.format';
$result = $testArray;
foreach(explode('.', $path) as $key) {
if(isset($result[$key])) {
$result = $result[$key];
}
}
print_r($result);