3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class c1 { public static function f1() { return "hello"; } public static $a = 10; public function f2() { echo $this->f1(); //prints "hello" echo $this->a; //ERROR:Undefined property: c1::$a in C:\wamp\www\class_in_php\example5.php on line 14 } } $obj1 = new c1; $obj1->f2();
Output for 7.0.0 - 7.1.0
hello Notice: Accessing static property c1::$a as non static in /in/sHZWZ on line 15 Notice: Undefined property: c1::$a in /in/sHZWZ on line 15
Output for 5.2.6 - 5.6.28
hello Strict Standards: Accessing static property c1::$a as non static in /in/sHZWZ on line 15 Notice: Undefined property: c1::$a in /in/sHZWZ on line 15
Output for 5.0.5 - 5.2.5
hello Strict Standards: Accessing static property c1::$a as non static in /in/sHZWZ on line 15 Notice: Undefined property: c1::$a in /in/sHZWZ on line 15
Output for 5.0.0 - 5.0.4
hello Notice: Undefined property: c1::$a in /in/sHZWZ on line 15
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/sHZWZ on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/sHZWZ on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/sHZWZ on line 5
Process exited with code 255.