3v4l.org

run code in 200+ PHP versions simultaneously
<?php function doStuff($value) { if('correct value' !== $value) { throw new \Exception('Wrong value'); } echo $value; } try { doStuff('incorrect value'); echo 'do another stuff' . PHP_EOL; } catch (\Exception $e) { echo 'Not correct value'; }
Output for 7.2.0 - 7.4.2
Not correct value