3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php declare(strict_types=1); class Apple{ function __construct(string $name) { return "Hello " + $name; } } (new Apple(1));
based on iILEY
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught TypeError: Argument 1 passed to Apple::__construct() must be of the type string, integer given, called in /in/HImkK on line 12 and defined in /in/HImkK:6 Stack trace: #0 /in/HImkK(12): Apple->__construct(1) #1 {main} thrown in /in/HImkK on line 6
Process exited with code 255.
Output for 5.3.19 - 5.6.28
Warning: Unsupported declare 'strict_types' in /in/HImkK on line 3 Catchable fatal error: Argument 1 passed to Apple::__construct() must be an instance of string, integer given, called in /in/HImkK on line 12 and defined in /in/HImkK on line 6
Process exited with code 255.