3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function foo($array, $default = null) { // to get $array['key1']['key2'] if (isset($array['key1']) && is_array($array['key1']) && isset($array['key1']['key2']) && is_array($array['key1']['key2'])) { return $array['key1']['key2']; } else { return $default; } } function bar($array, $default = null) { return array_get($array, 'key1.key2', $default); }
Output for 4.3.0 - 7.1.0