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