3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php for ($i = 1; $i <= 10; $i++) { try { switch ($i) { case 2: throw new Exception('Exception: '. $i); break; } } catch (Exception $e) { echo '<pre>'. $e->getMessage() .'</pre>'; } echo 'Loop count: '. $i . PHP_EOL; }
based on 58MkP
Output for 5.0.2 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
Loop count: 1 <pre>Exception: 2</pre>Loop count: 2 Loop count: 3 Loop count: 4 Loop count: 5 Loop count: 6 Loop count: 7 Loop count: 8 Loop count: 9 Loop count: 10
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.0.0 - 5.0.1
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/Ijj6K on line 13 Loop count: 1PHP_EOL<pre>Exception: 2</pre> Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/Ijj6K on line 13 Loop count: 2PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/Ijj6K on line 13 Loop count: 3PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/Ijj6K on line 13 Loop count: 4PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/Ijj6K on line 13 Loop count: 5PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/Ijj6K on line 13 Loop count: 6PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/Ijj6K on line 13 Loop count: 7PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/Ijj6K on line 13 Loop count: 8PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/Ijj6K on line 13 Loop count: 9PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/Ijj6K on line 13 Loop count: 10PHP_EOL
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected '{' in /in/Ijj6K on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected '{' in /in/Ijj6K on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/Ijj6K on line 3
Process exited with code 255.