3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A { public function echo() { echo static::getClassNameS(), "\n"; echo $this->getClassNameD(), "\n"; } public static function getClassNameS() { return 'A'; } public function getClassNameD() { return 'A'; } } class B extends A { public static function getClassNameS() { return 'A'; } public function getClassNameD() { return 'A'; } } (new B())->echo();
Output for 7.0.0 - 7.2.0
A A
Output for 5.4.10 - 5.6.21
Parse error: syntax error, unexpected 'echo' (T_ECHO), expecting identifier (T_STRING) in /in/n0DQm on line 5
Process exited with code 255.
Output for 5.3.20 - 5.3.29
Parse error: syntax error, unexpected T_ECHO, expecting T_STRING in /in/n0DQm on line 5
Process exited with code 255.