3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class AbClass { const ABC = "12345"; public function printThing() { echo 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.4.0 - 5.4.27
Parse error: syntax error, unexpected 'thing2' (T_STRING), expecting variable (T_VARIABLE) in /in/SnHJW on line 12
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE in /in/SnHJW on line 12
Process exited with code 255.

preferences:
182.08 ms | 1395 KiB | 64 Q