3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A { public static function A() { echo 'direct owner: '.__CLASS__."\n"; echo 'called as part of: '.self::class."\n"; echo 'called by instance of: '.static::class."\n"; } } class B extends A { } class C { function __construct() { B::A(); } } new C();
based on 0IDQI
Output for 7.0.0 - 7.0.2
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in /in/kbmG1 on line 3 Fatal error: Constructor A::A() cannot be static in /in/kbmG1 on line 3
Process exited with code 255.
Output for 5.5.24 - 5.6.17
Fatal error: Constructor A::A() cannot be static in /in/kbmG1 on line 9
Process exited with code 255.
Output for 5.4.11 - 5.4.45
Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /in/kbmG1 on line 6
Process exited with code 255.
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected T_CLASS, expecting T_STRING or T_VARIABLE or '$' in /in/kbmG1 on line 6
Process exited with code 255.