3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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 7.2.0
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.0.0 - 7.1.10
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.3.21 - 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)