3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Samsung { public function make() :string { return "This is Samsung product"; } } class Galaxy extends Samsung { public function make() { return new Samsung(); } } $vendor = new Galaxy(); echo $vendor->make();
Output for 7.0.0
Fatal error: Declaration of Galaxy::make() must be compatible with Samsung::make(): string in /in/nt5Hm on line 12
Process exited with code 255.
Output for 5.5.24 - 5.5.30, 5.6.8 - 5.6.16
Parse error: syntax error, unexpected ':', expecting ';' or '{' in /in/nt5Hm on line 3
Process exited with code 255.

preferences:
164.72 ms | 1395 KiB | 24 Q