suppose i have a multidimensional array like something like this:
array(\"test2\" => array(\"test3\" => 1)), .
You could use
function get_multi($arr, $str) { foreach (explode('.', $str) as $key) { if (!array_key_exists($key, $arr)) { return NULL; } $arr = $arr[$key]; } return $arr; }