3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); function &a(int &$a, string &$b) : int { $b = &$a; } $a = 1; $b = "abc"; a($a, $b);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Fatal error: Uncaught TypeError: a(): Return value must be of type int, none returned in /in/fncmu:7 Stack trace: #0 /in/fncmu(11): a(1, 1) #1 {main} thrown in /in/fncmu on line 7
Process exited with code 255.
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Fatal error: Uncaught TypeError: Return value of a() must be of the type int, none returned in /in/fncmu:7 Stack trace: #0 /in/fncmu(11): a(1, 1) #1 {main} thrown in /in/fncmu on line 7
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33
Fatal error: Uncaught TypeError: Return value of a() must be of the type integer, none returned in /in/fncmu:7 Stack trace: #0 /in/fncmu(11): a(1, 1) #1 {main} thrown in /in/fncmu on line 7
Process exited with code 255.
Output for 5.5.0 - 5.5.35, 5.6.0 - 5.6.21
Warning: Unsupported declare 'strict_types' in /in/fncmu on line 3 Parse error: syntax error, unexpected ':', expecting '{' in /in/fncmu on line 5
Process exited with code 255.

preferences:
184.43 ms | 401 KiB | 224 Q