3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php for ($i = 5; $i > 0; $i--) { $ratingAvg[$i] = 0; } var_dump($ratingAvg); $ratingAvg = array_fill(5,1,0); var_dump($ratingAvg); $ratingAvg = array_fill_keys(range(5, 1), 0); var_dump($ratingAvg);
Output for 5.2.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
array(5) { [5]=> int(0) [4]=> int(0) [3]=> int(0) [2]=> int(0) [1]=> int(0) } array(1) { [5]=> int(0) } array(5) { [5]=> int(0) [4]=> int(0) [3]=> int(0) [2]=> int(0) [1]=> int(0) }
Output for 5.0.0 - 5.1.6
array(5) { [5]=> int(0) [4]=> int(0) [3]=> int(0) [2]=> int(0) [1]=> int(0) } array(1) { [5]=> int(0) } Fatal error: Call to undefined function array_fill_keys() in /in/abO8U on line 14
Process exited with code 255.
Output for 4.4.5 - 4.4.9
array(5) { [5]=> int(0) [4]=> int(0) [3]=> int(0) [2]=> int(0) [1]=> int(0) } array(1) { [5]=> int(0) } Fatal error: Call to undefined function: array_fill_keys() in /in/abO8U on line 14
Process exited with code 255.
Output for 4.3.2 - 4.4.4
array(5) { [5]=> int(0) [4]=> int(0) [3]=> int(0) [2]=> int(0) [1]=> int(0) } array(1) { [5]=> int(0) } Fatal error: Call to undefined function: array_fill_keys() in /in/abO8U on line 14
Process exited with code 255.
Output for 4.3.0 - 4.3.1
array(5) { [5]=> int(0) [4]=> int(0) [3]=> int(0) [2]=> int(0) [1]=> int(0) } array(1) { [5]=> int(0) } Fatal error: Call to undefined function: array_fill_keys() in /in/abO8U on line 14