3v4l.org

run code in 300+ PHP versions simultaneously
<?php function array_by_path($value, $path) { $curr = array_shift($path); if (!isset($value[$curr])) { return null; } elseif (is_array($value[$curr])) { return array_by_path($value[$curr]); } return $value; } $test = array( 'wot' => array( 'mate' => 'hello' ) ); echo array_by_path($test, ['wot', 'mate']);

preferences:
54.33 ms | 402 KiB | 5 Q