3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types = 1); $contributors = ['Me', 'To']; array_walk($contributors, function(string $contributor) : string { $contributor = sprintf("%s, thank you very much for PHP7!", $contributor); }); echo implode("\n", $contributors);
Output for 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught TypeError: {closure}(): Return value must be of type string, none returned in /in/ER3WS:6 Stack trace: #0 [internal function]: {closure}('Me, thank you v...', 0) #1 /in/ER3WS(4): array_walk(Array, Object(Closure)) #2 {main} thrown in /in/ER3WS on line 6
Process exited with code 255.
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28
Fatal error: Uncaught TypeError: {closure}(): Return value must be of type string, none returned in /in/ER3WS:6 Stack trace: #0 [internal function]: {closure}('Me, thank you v...', 0) #1 /in/ER3WS(6): array_walk(Array, Object(Closure)) #2 {main} thrown in /in/ER3WS on line 6
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Fatal error: Uncaught TypeError: Return value of {closure}() must be of the type string, none returned in /in/ER3WS:6 Stack trace: #0 [internal function]: {closure}('Me, thank you v...', 0) #1 /in/ER3WS(6): array_walk(Array, Object(Closure)) #2 {main} thrown in /in/ER3WS on line 6
Process exited with code 255.
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
Warning: Unsupported declare 'strict_types' in /in/ER3WS on line 2 Parse error: syntax error, unexpected ':', expecting '{' in /in/ER3WS on line 4
Process exited with code 255.

preferences:
167.94 ms | 402 KiB | 225 Q