3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php abstract class AbClass { const ABC = "12345"; public function printThing() { echo self::ABC . PHP_EOL; } } class Sub extends AbClass { protected $thing2; public function __construct() { $this->thing2 = "def"; } public function printThing() { parent::printThing(); echo ABC . PHP_EOL; echo $this->thing2 . PHP_EOL; } } $s = new Sub(); $s->printThing();
Output for 5.0.2 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
12345 Notice: Use of undefined constant ABC - assumed 'ABC' in /in/WEKJn on line 19 ABC def
Output for 5.0.0 - 5.0.1
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/WEKJn on line 7 12345PHP_EOL Notice: Use of undefined constant ABC - assumed 'ABC' in /in/WEKJn on line 19 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/WEKJn on line 19 ABCPHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/WEKJn on line 20 defPHP_EOL
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_CLASS in /in/WEKJn on line 3
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_CLASS in /in/WEKJn on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/WEKJn on line 3
Process exited with code 255.