Add your own error handling in case the key path isn't in your array, but something like:
$array = array('data' => array('one' => 'first', 'two' => 'second'));
$key = 'data.one';
function find($key, $array) {
$parts = explode('.', $key);
foreach ($parts as $part) {
$array = $array[$part];
}
return $array;
}
$result = find($key, $array);
var_dump($result);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…