3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php interface Vendor { public function make(); } class Samsung implements Vendor{ public function make() :string { return "This is Samsung product"; } } class Galaxy extends Samsung { public function make() { return new Samsung(); } } $vendor = new Samsung(); echo $vendor->make();
based on 2pjI0
Output for 7.2.0
Fatal error: Declaration of Galaxy::make() must be compatible with Samsung::make(): string in /in/W4l0H on line 12
Process exited with code 255.
Output for 7.0.0 - 7.1.10
This is Samsung product
Output for 5.3.20 - 5.6.28
Parse error: syntax error, unexpected ':', expecting ';' or '{' in /in/W4l0H on line 7
Process exited with code 255.