3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Issue #8 array_first and array_last alias standard library functions * @link https://github.com/brandonwamboldt/utilphp/issues/8 */ class pupil { static function value($value) { return $value; } } $array = range(0, 1); var_dump(each($array)); $first = reset(pupil::value($array)); var_dump(each($array), each($array));
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 Error: Call to undefined function each() in /in/fLHMo:16 Stack trace: #0 {main} thrown in /in/fLHMo on line 16
Process exited with code 255.
Output for 7.2.0 - 7.2.33, 7.3.16 - 7.3.31, 7.4.0 - 7.4.33
Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /in/fLHMo on line 16 array(4) { [1]=> int(0) ["value"]=> int(0) [0]=> int(0) ["key"]=> int(0) } Notice: Only variables should be passed by reference in /in/fLHMo on line 18 array(4) { [1]=> int(1) ["value"]=> int(1) [0]=> int(1) ["key"]=> int(1) } bool(false)
Output for 7.3.32 - 7.3.33
array(4) { [1]=> int(0) ["value"]=> int(0) [0]=> int(0) ["key"]=> int(0) } array(4) { [1]=> int(1) ["value"]=> int(1) [0]=> int(1) ["key"]=> int(1) } bool(false)
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20
array(4) { [1]=> int(0) ["value"]=> int(0) [0]=> int(0) ["key"]=> int(0) } Notice: Only variables should be passed by reference in /in/fLHMo on line 18 array(4) { [1]=> int(1) ["value"]=> int(1) [0]=> int(1) ["key"]=> int(1) } bool(false)
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
array(4) { [1]=> int(0) ["value"]=> int(0) [0]=> int(0) ["key"]=> int(0) } Strict Standards: Only variables should be passed by reference in /in/fLHMo on line 18 array(4) { [1]=> int(1) ["value"]=> int(1) [0]=> int(1) ["key"]=> int(1) } bool(false)

preferences:
169.04 ms | 402 KiB | 179 Q