3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A{ static $default="A::default "; public static $public="A::public "; protected static $protected="A::protected "; private static $private="A::private "; function test(){ echo $this::$default; echo $this::$public; echo $this::$protected; echo static::$private;//error } } class B extends A{ static $default="B::default "; public static $public="B::public "; protected static $protected="B::protected "; private static $private="B::private "; } $obj = new B; $obj->test();
based on B1Rbr
Output for 7.0.0 - 7.2.6
B::default B::public B::protected Fatal error: Uncaught Error: Cannot access private property B::$private in /in/3FACv:12 Stack trace: #0 /in/3FACv(23): A->test() #1 {main} thrown in /in/3FACv on line 12
Process exited with code 255.
Output for hhvm-3.15.4
B::default B::public B::protected Fatal error: Uncaught Error: Invalid static property access: B::private in /in/3FACv:12 Stack trace: #0 /in/3FACv(23): A->test() #1 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
B::default B::public B::protected Fatal error: Cannot access private property B::$private in /in/3FACv on line 12
Process exited with code 255.