3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Bar{ function __get($a){ throw new Error("no prop error\n"); } } $bar = new Bar; var_dump(isset($bar->foo) ? $bar->foo : "qux"); var_dump($bar->foo ?? "qux");
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.26, 8.0.0 - 8.0.13, 8.1rc1 - rc3
string(3) "qux" Fatal error: Uncaught Error: no prop error in /in/UI13h:5 Stack trace: #0 /in/UI13h(11): Bar->__get('foo') #1 {main} thrown in /in/UI13h on line 5
Process exited with code 255.

preferences:
38.14 ms | 460 KiB | 5 Q