3v4l.org

run code in 300+ PHP versions simultaneously
<?php $x = 0; try { if ( $x == 0 ) { throw new Exception('x is zero'); } } catch ( Exception $ex ) { echo 'Caught exception: ', $ex->getMessage(); } echo 'after try block';
Output for 8.0.1 - 8.0.27, 8.1.0 - 8.1.13, 8.2.0 - 8.2.1
Parse error: syntax error, unexpected variable "$ex", expecting ")" in /in/TW2Zr on line 8
Process exited with code 255.

preferences:
164.54 ms | 1000 KiB | 7 Q