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 '<pre>Loop count: '. $i .'</pre>'; }
based on GCb86
Output for 5.4.0 - 5.4.45
<pre>Loop count: 1</pre><pre>Exception: 2</pre><pre>Loop count: 2</pre><pre>Loop count: 3</pre><pre>Loop count: 4</pre><pre>Loop count: 5</pre><pre>Loop count: 6</pre><pre>Loop count: 7</pre><pre>Loop count: 8</pre><pre>Loop count: 9</pre><pre>Loop count: 10</pre>