3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface I {} interface J {} // Simulate a "never" parameter type. interface AlmostNever extends I, J {} class C implements I {} interface Base { public function foo(AlmostNever $x, AlmostNever $y): mixed; } interface ReturnI extends Base { public function foo(AlmostNever $x, AlmostNever $y): I; } interface AcceptI extends Base { public function foo(I $x, AlmostNever $y): mixed; } interface AcceptSecondI extends Base { public function foo(AlmostNever $x, I $y): mixed; } class AcceptReturnI implements ReturnI, AcceptI, AcceptSecondI { public function foo(I $x, I $y): I { return $x; } } function f(AcceptI&AcceptSecondI&ReturnI $callme, I $x): I { return $callme->foo($x, $x); } f(new AcceptReturnI(), new C(), new C());
Output for git.master_jit, git.master, rfc.property-hooks

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:
23.33 ms | 405 KiB | 5 Q