3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a['abc']['def']['ghi'] = 'meukee!'; function getArrayValueByKeys(array $array, $key, ...$keys) { if (!isset($array[$key])) throw new Exception; if(is_array($array[$key])) return getArrayValueByKeys($array[$key], ...$keys); return $array[$key]; } function getArrayValueByKeysMS(array $array, $keys, $depth = 0) { $key = $keys[$depth]; if (!isset($array[$key])) throw new Exception; if(is_array($array[$key])) return getArrayValueByKeys($array[$key], $keys, $depth+1); return $array[$key]; } echo getArrayValueByKeys($a, ...['abc', 'def', 'ghi']); echo getArrayValueByKeysMS($a, ['abc', 'def', 'ghi']); echo getArrayValueByKeys($a, ...['ddd', 'def', 'ghi']);
Output for git.master, git.master_jit
meukee! Fatal error: Uncaught TypeError: Illegal offset type in isset or empty in /in/T1t1Y:7 Stack trace: #0 /in/T1t1Y(23): getArrayValueByKeys(Array, Array, 1) #1 /in/T1t1Y(31): getArrayValueByKeysMS(Array, Array) #2 {main} thrown in /in/T1t1Y on line 7
Process exited with code 255.
Output for rfc.property-hooks
meukee! Fatal error: Uncaught TypeError: Cannot access offset of type array in isset or empty in /in/T1t1Y:7 Stack trace: #0 /in/T1t1Y(23): getArrayValueByKeys(Array, Array, 1) #1 /in/T1t1Y(31): getArrayValueByKeysMS(Array, Array) #2 {main} thrown in /in/T1t1Y on line 7
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
43.78 ms | 401 KiB | 8 Q