3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $bar; public function __construct() { $this->bar = 'beep'; } } class MoreFoo extends Foo { private $bar; private $rab; public function __construct() { parent::__construct(); } public getBar() { return $this->bar; } } $moreFoo = new MoreFoo(); var_dump($moreFoo->getBar());
Output for 5.4.0 - 5.4.28
Parse error: syntax error, unexpected 'getBar' (T_STRING), expecting variable (T_VARIABLE) in /in/v0JR1 on line 19
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/v0JR1 on line 19
Process exited with code 255.

preferences:
173.93 ms | 1395 KiB | 65 Q