3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class A { private $str = "Pysh!.."; public function f() { B::g(); } } class B { private $str = "Ololo!.."; public function g() { print($this->str."\n"); } } (new A)->f();
based on pjj2f
Output for 7.0.0 - 7.1.0
Deprecated: Non-static method B::g() should not be called statically in /in/E8Vil on line 7 Fatal error: Uncaught Error: Using $this when not in object context in /in/E8Vil:15 Stack trace: #0 /in/E8Vil(7): B::g() #1 /in/E8Vil(19): A->f() #2 {main} thrown in /in/E8Vil on line 15
Process exited with code 255.
Output for 5.6.7 - 5.6.28
Deprecated: Non-static method B::g() should not be called statically, assuming $this from incompatible context in /in/E8Vil on line 7 Fatal error: Cannot access private property A::$str in /in/E8Vil on line 15
Process exited with code 255.
Output for 5.4.0 - 5.5.35
Strict Standards: Non-static method B::g() should not be called statically, assuming $this from incompatible context in /in/E8Vil on line 7 Fatal error: Cannot access private property A::$str in /in/E8Vil on line 15
Process exited with code 255.
Output for 5.1.0 - 5.3.29
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/E8Vil on line 19
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_OBJECT_OPERATOR in /in/E8Vil on line 19
Process exited with code 255.
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/E8Vil on line 4
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/E8Vil on line 4
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/E8Vil on line 4
Process exited with code 255.