3v4l.org

run code in 300+ PHP versions simultaneously
<?php function &test(): int { $x = 0; try { return $x; } finally { $x = 'test'; } } $x = &test(); var_dump($x);
Output for 8.3.25 - 8.3.30, 8.4.12 - 8.4.18, 8.5.0 - 8.5.3
Fatal error: Uncaught TypeError: test(): Return value must be of type int, string returned in /in/BRBW9:6 Stack trace: #0 /in/BRBW9(12): test() #1 {main} thrown in /in/BRBW9 on line 6
Process exited with code 255.
Output for 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.24, 8.4.1 - 8.4.11
string(4) "test"

preferences:
58.76 ms | 838 KiB | 4 Q