3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface I { public function a(int $a): string; } Class C implements I { public function a(int|string $a): string { return "foo"; } } class D implements I { public function a(int $a): string { return "foo"; } } function test(I $subject) { print $subject->a('beep'); } test(new C()); test(new D());
Output for git.master_jit, git.master
foo Fatal error: Uncaught TypeError: D::a(): Argument #1 ($a) must be of type int, string given, called in /in/WUTv4 on line 21 and defined in /in/WUTv4:15 Stack trace: #0 /in/WUTv4(21): D->a('beep') #1 /in/WUTv4(25): test(Object(D)) #2 {main} thrown in /in/WUTv4 on line 15
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:
36.18 ms | 405 KiB | 5 Q