3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $array = range(5.0, 3.0, 0.17); var_dump($array); var_dump(array_slice($array, -4, 1, true)); var_dump(array_slice($array, -4, 1, true));
based on 0frap
Output for 5.0.2 - 7.2.0
array(12) { [0]=> float(5) [1]=> float(4.83) [2]=> float(4.66) [3]=> float(4.49) [4]=> float(4.32) [5]=> float(4.15) [6]=> float(3.98) [7]=> float(3.81) [8]=> float(3.64) [9]=> float(3.47) [10]=> float(3.3) [11]=> float(3.13) } array(1) { [8]=> float(3.64) } array(1) { [8]=> float(3.64) }
Output for 5.0.0 - 5.0.1
array(12) { [0]=> float(5) [1]=> float(4.83) [2]=> float(4.66) [3]=> float(4.49) [4]=> float(4.32) [5]=> float(4.15) [6]=> float(3.98) [7]=> float(3.81) [8]=> float(3.64) [9]=> float(3.47) [10]=> float(3.3) [11]=> float(3.13) } Warning: Wrong parameter count for array_slice() in /in/QcH06 on line 4 NULL Warning: Wrong parameter count for array_slice() in /in/QcH06 on line 5 NULL
Output for 4.3.0 - 4.4.9
Warning: Wrong parameter count for range() in /in/QcH06 on line 2 NULL Warning: Wrong parameter count for array_slice() in /in/QcH06 on line 4 NULL Warning: Wrong parameter count for array_slice() in /in/QcH06 on line 5 NULL