3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function generateSubArray(array $keys) { foreach($keys as $key) { if(!isset($subArray[$key])){ $subArray[$key] = []; } $subArray = $subArray[$key]; } return $subArray; } $ret = Utils::generateSubArray(['name', 'id', 'fix']); var_dump($ret);
based on eZHD5
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Class 'Utils' not found in /in/9B9M2:15 Stack trace: #0 {main} thrown in /in/9B9M2 on line 15
Process exited with code 255.
Output for 5.4.1 - 5.6.28
Fatal error: Class 'Utils' not found in /in/9B9M2 on line 15
Process exited with code 255.
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/9B9M2 on line 8
Process exited with code 255.