3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $bar; public function baz() { var_dump($this->bar); var_dump(get_class($this->bar)); } } $foo = new Foo(); $foo->baz();
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
NULL Fatal error: Uncaught TypeError: get_class(): Argument #1 ($object) must be of type object, null given in /in/dVvNX:10 Stack trace: #0 /in/dVvNX(15): Foo->baz() #1 {main} thrown in /in/dVvNX on line 10
Process exited with code 255.
Output for 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33
NULL Warning: get_class() expects parameter 1 to be object, null given in /in/dVvNX on line 10 bool(false)
Output for 5.4.2 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.20
NULL string(3) "Foo"

preferences:
212.76 ms | 402 KiB | 229 Q