3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Test{ public $var=null; function __construct($input) { $var = $input; } } $a = new Test(4); echo $a->$var;
based on ikf20
Output for 7.1.0 - 7.2.0
Notice: Undefined variable: var in /in/NBksa on line 11 Notice: Undefined property: Test::$ in /in/NBksa on line 11
Output for 7.0.0 - 7.0.20
Notice: Undefined variable: var in /in/NBksa on line 11 Fatal error: Uncaught Error: Cannot access empty property in /in/NBksa:11 Stack trace: #0 {main} thrown in /in/NBksa on line 11
Process exited with code 255.
Output for 5.3.22 - 5.6.28
Notice: Undefined variable: var in /in/NBksa on line 11 Fatal error: Cannot access empty property in /in/NBksa on line 11
Process exited with code 255.