3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class A { protected $a; public function __construct($a) { $this->a = $a; } public function x() { echo 'foo'; } } class B extends A { protected $b; public function __construct($a, $b) { parent::__construct($a); $this->b = $b; } public function y() { echo 'bar'; } } $m = new A('foooooo'); var_dump($m); $n = (B) $m; var_dump($n);
Output for 5.4.0 - 5.4.22
Parse error: syntax error, unexpected '$m' (T_VARIABLE) in /in/3lEf5 on line 20
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_VARIABLE in /in/3lEf5 on line 20
Process exited with code 255.