3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyClass { private $foo = FALSE; public function __construct() { $this->$foo = TRUE; echo($this->$foo); } } $bar = new MyClass();
Output for 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Warning: Undefined variable $foo in /in/EDEde on line 8 Deprecated: Creation of dynamic property MyClass::$ is deprecated in /in/EDEde on line 8 Warning: Undefined variable $foo in /in/EDEde on line 10 1
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28
Warning: Undefined variable $foo in /in/EDEde on line 8 Warning: Undefined variable $foo in /in/EDEde on line 10 1
Output for 7.1.0 - 7.1.30, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Notice: Undefined variable: foo in /in/EDEde on line 8 Notice: Undefined variable: foo in /in/EDEde on line 10 1
Output for 7.3.32 - 7.3.33
1
Output for 7.0.0 - 7.0.33
Notice: Undefined variable: foo in /in/EDEde on line 8 Fatal error: Uncaught Error: Cannot access empty property in /in/EDEde:8 Stack trace: #0 /in/EDEde(14): MyClass->__construct() #1 {main} thrown in /in/EDEde on line 8
Process exited with code 255.
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
Notice: Undefined variable: foo in /in/EDEde on line 8 Fatal error: Cannot access empty property in /in/EDEde on line 8
Process exited with code 255.

preferences:
199.76 ms | 402 KiB | 360 Q