array('one' => array('two'=>'kek'));
$string = '[one][two]';
$arr = ['one' => ['two' => 'kek']];
$key = '[one][two]';
function arr_key_val($arr, $key) {
$keys = trim($key, '[]');
$keys = explode('][', $keys);
$return = $arr;
foreach ($keys as $k)
$return = $return[$k];
return $return;
}
echo arr_key_val($arr, $key);