3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class trial{ public $id; //public static $id; public function show(){ echo $this->$id; } } $obj = new trial(); $obj->id = 1; $obj->show();
based on gTNb6
Output for 7.1.0 - 7.2.0
Notice: Undefined variable: id in /in/1iYZD on line 8 Notice: Undefined property: trial::$ in /in/1iYZD on line 8
Output for 7.0.0 - 7.0.20
Notice: Undefined variable: id in /in/1iYZD on line 8 Fatal error: Uncaught Error: Cannot access empty property in /in/1iYZD:8 Stack trace: #0 /in/1iYZD(14): trial->show() #1 {main} thrown in /in/1iYZD on line 8
Process exited with code 255.
Output for 5.3.18 - 5.6.28
Notice: Undefined variable: id in /in/1iYZD on line 8 Fatal error: Cannot access empty property in /in/1iYZD on line 8
Process exited with code 255.