3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class ClassName { public function __construct() { echo 'object begin' . PHP_EOL; throw new Exception('!! Exception !!'); echo 'object after thow' . PHP_EOL; } public function __destruct() { echo 'object end' . PHP_EOL; } } echo '<< script begin >>' . PHP_EOL; try { $o = new ClassName; } catch (Exception $e) { echo $e->getMessage() . PHP_EOL; } finally { echo 'finally block, object ' . (isset($o) ? 'exist' :'not exist') . PHP_EOL; } echo '<< script end >>' . PHP_EOL;
based on D7OZV
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.2.6
<< script begin >> object begin !! Exception !! finally block, object not exist << script end >>