3v4l.org

run code in 300+ PHP versions simultaneously
<?php reset ($arr); while (list($key, $value) = each ($arr)) { echo "Key: $key; Value: $value<br>\n"; } foreach ($arr as $key => $value) { echo "Key: $key; Value: $value<br>\n"; } ?>
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught TypeError: reset(): Argument #1 ($array) must be of type array, null given in /in/VrpTt:2 Stack trace: #0 /in/VrpTt(2): reset(NULL) #1 {main} thrown in /in/VrpTt on line 2
Process exited with code 255.
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Warning: reset() expects parameter 1 to be array, null given in /in/VrpTt on line 2 Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /in/VrpTt on line 3 Warning: Variable passed to each() is not an array or object in /in/VrpTt on line 3 Warning: Invalid argument supplied for foreach() in /in/VrpTt on line 6
Output for 5.4.2 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.25, 7.3.32 - 7.3.33
Warning: reset() expects parameter 1 to be array, null given in /in/VrpTt on line 2 Warning: Variable passed to each() is not an array or object in /in/VrpTt on line 3 Warning: Invalid argument supplied for foreach() in /in/VrpTt on line 6

preferences:
219.57 ms | 403 KiB | 242 Q