3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { protected $x=10; public function myMethod($x=0); { return $this->x; } } class B extends A { public function myMethod($x=0); { return 2*$this->x; } } ?>
Output for 7.1.0 - 7.1.6
Parse error: syntax error, unexpected '{', expecting function (T_FUNCTION) or const (T_CONST) in /in/KfbqU on line 6
Process exited with code 255.
Output for 7.0.0 - 7.0.20
Parse error: syntax error, unexpected '{', expecting function (T_FUNCTION) in /in/KfbqU on line 6
Process exited with code 255.

preferences:
174.75 ms | 1395 KiB | 35 Q