3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php //error_reporting(-1); class A { function B() { echo "instance method B\n"; } static function C() { echo "static method C\n"; } } $a = new A(); echo "Calling B statically referenced: "; $a::B(); echo "Calling C statically referenced: "; $a::C(); echo "Calling B statically: "; A::B(); echo "Calling C statically: "; A::C(); echo "Calling B instantiated: "; $a->B(); echo "Calling C instantiated: "; $a->C();
based on PNnWY
Output for 7.0.0 - 7.1.0
Calling B statically referenced: Deprecated: Non-static method A::B() should not be called statically in /in/tuf1I on line 15 instance method B Calling C statically referenced: static method C Calling B statically: Deprecated: Non-static method A::B() should not be called statically in /in/tuf1I on line 19 instance method B Calling C statically: static method C Calling B instantiated: instance method B Calling C instantiated: static method C
Output for hhvm-3.10.0 - 3.12.0
Calling B statically referenced: instance method B Calling C statically referenced: static method C Calling B statically: instance method B Calling C statically: static method C Calling B instantiated: instance method B Calling C instantiated: static method C
Output for 5.3.0 - 5.6.28
Calling B statically referenced: Strict Standards: Non-static method A::B() should not be called statically in /in/tuf1I on line 15 instance method B Calling C statically referenced: static method C Calling B statically: Strict Standards: Non-static method A::B() should not be called statically in /in/tuf1I on line 19 instance method B Calling C statically: static method C Calling B instantiated: instance method B Calling C instantiated: static method C
Output for 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in /in/tuf1I on line 15
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_PAAMAYIM_NEKUDOTAYIM in /in/tuf1I on line 15
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STATIC, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/tuf1I on line 8
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_STATIC, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/tuf1I on line 8
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/tuf1I on line 8
Process exited with code 255.