3v4l.org

run code in 300+ PHP versions simultaneously
<?php try { (function() { return throw new Exception("first"); })(); } catch (Throwable $e) { var_dump($e); } try { (function() { throw new Exception("second"); })(); } catch (Throwable $e) { var_dump($e); } try { (function() { return throw throw throw new Exception("second"); })(); } catch (Throwable $e) { var_dump($e); }
Output for 8.4.1 - 8.4.14
object(Exception)#2 (7) { ["message":protected]=> string(5) "first" ["string":"Exception":private]=> string(0) "" ["code":protected]=> int(0) ["file":protected]=> string(9) "/in/RqqZK" ["line":protected]=> int(3) ["trace":"Exception":private]=> array(1) { [0]=> array(4) { ["file"]=> string(9) "/in/RqqZK" ["line"]=> int(3) ["function"]=> string(21) "{closure:/in/RqqZK:3}" ["args"]=> array(0) { } } } ["previous":"Exception":private]=> NULL } object(Exception)#3 (7) { ["message":protected]=> string(6) "second" ["string":"Exception":private]=> string(0) "" ["code":protected]=> int(0) ["file":protected]=> string(9) "/in/RqqZK" ["line":protected]=> int(5) ["trace":"Exception":private]=> array(1) { [0]=> array(4) { ["file"]=> string(9) "/in/RqqZK" ["line"]=> int(5) ["function"]=> string(21) "{closure:/in/RqqZK:5}" ["args"]=> array(0) { } } } ["previous":"Exception":private]=> NULL } object(Exception)#1 (7) { ["message":protected]=> string(6) "second" ["string":"Exception":private]=> string(0) "" ["code":protected]=> int(0) ["file":protected]=> string(9) "/in/RqqZK" ["line":protected]=> int(7) ["trace":"Exception":private]=> array(1) { [0]=> array(4) { ["file"]=> string(9) "/in/RqqZK" ["line"]=> int(7) ["function"]=> string(21) "{closure:/in/RqqZK:7}" ["args"]=> array(0) { } } } ["previous":"Exception":private]=> NULL }
Output for 8.1.32, 8.2.0 - 8.2.29, 8.3.0 - 8.3.27
object(Exception)#2 (7) { ["message":protected]=> string(5) "first" ["string":"Exception":private]=> string(0) "" ["code":protected]=> int(0) ["file":protected]=> string(9) "/in/RqqZK" ["line":protected]=> int(3) ["trace":"Exception":private]=> array(1) { [0]=> array(4) { ["file"]=> string(9) "/in/RqqZK" ["line"]=> int(3) ["function"]=> string(9) "{closure}" ["args"]=> array(0) { } } } ["previous":"Exception":private]=> NULL } object(Exception)#3 (7) { ["message":protected]=> string(6) "second" ["string":"Exception":private]=> string(0) "" ["code":protected]=> int(0) ["file":protected]=> string(9) "/in/RqqZK" ["line":protected]=> int(5) ["trace":"Exception":private]=> array(1) { [0]=> array(4) { ["file"]=> string(9) "/in/RqqZK" ["line"]=> int(5) ["function"]=> string(9) "{closure}" ["args"]=> array(0) { } } } ["previous":"Exception":private]=> NULL } object(Exception)#1 (7) { ["message":protected]=> string(6) "second" ["string":"Exception":private]=> string(0) "" ["code":protected]=> int(0) ["file":protected]=> string(9) "/in/RqqZK" ["line":protected]=> int(7) ["trace":"Exception":private]=> array(1) { [0]=> array(4) { ["file"]=> string(9) "/in/RqqZK" ["line"]=> int(7) ["function"]=> string(9) "{closure}" ["args"]=> array(0) { } } } ["previous":"Exception":private]=> NULL }

preferences:
67.53 ms | 414 KiB | 5 Q