3v4l.org

run code in 200+ PHP versions simultaneously
<?php class Foo { public function __construct() : Foo { return "bar"; } } $foo = new Foo(); var_dump($foo);
based on B6Thg
Output for 7.1.25 - 7.3.7
Fatal error: Constructor Foo::__construct() cannot declare a return type in /in/rsikK on line 3
Process exited with code 255.