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"; } } function test(I $subject) { print $subject->a('beep'); } test(new C());
Output for 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.13
foo

preferences:
56.12 ms | 406 KiB | 5 Q