3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $stuff = ['a' => ['b' => 'c']]; $path = 'a.c'; $parts = explode('.', $path); $value = &$stuff; foreach ($parts as $part) { if (isset($value[$part])) { $value = &$value[$part]; } else { throw new \RuntimeException('fail at: ' . $part); } } var_dump($value);
based on 8C4J2
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught RuntimeException: fail at: c in /in/l7E4u:13 Stack trace: #0 {main} thrown in /in/l7E4u on line 13
Process exited with code 255.
Output for 5.4.9 - 5.6.28
Fatal error: Uncaught exception 'RuntimeException' with message 'fail at: c' in /in/l7E4u:13 Stack trace: #0 {main} thrown in /in/l7E4u on line 13
Process exited with code 255.
Output for 5.3.19 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/l7E4u on line 3
Process exited with code 255.