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.26, 8.4.12 - 8.4.13
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.2.0 - 8.2.29, 8.3.0 - 8.3.24, 8.4.1 - 8.4.11
string(4) "test"

preferences:
50.04 ms | 407 KiB | 5 Q