3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Request {} class Route {} // Before: docs only: array|string|\Stringable|null /* interface FooInterface { public function getTitle(Request $request, Route $route); } */ // If we use native typehints instead interface FooInterface { public function getTitle(Request $request, Route $route): null|array|string|\Stringable; } // This is an implementation written against the original, i.e. with no return types specified. We should not break it. class SomeFoo implements FooInterface { public function getTitle(Request $request, Route $route) { return 'yay'; } } $test = new SomeFoo(); var_dump($test->getTitle(new Request(), new Route()));
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Declaration of SomeFoo::getTitle(Request $request, Route $route) must be compatible with FooInterface::getTitle(Request $request, Route $route): Stringable|array|string|null in /in/WYop7 on line 18
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
27.3 ms | 405 KiB | 5 Q