3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $i = 0; // menghitung loop $j = 0; // key untuk $data $contoh = array_fill(0, 11); foreach($contoh as $c) { $temp[$i] = $c; $i++; if( ($i % 3) == 0) { $data[$j] = $temp[$i]; $j++; } } print_r($temp); print_r($data);
based on 2Jn4Q
Output for 5.3.0 - 7.2.0
Warning: array_fill() expects exactly 3 parameters, 2 given in /in/f7QFG on line 5 Warning: Invalid argument supplied for foreach() in /in/f7QFG on line 7 Notice: Undefined variable: temp in /in/f7QFG on line 19 Notice: Undefined variable: data in /in/f7QFG on line 20
Output for 5.0.4 - 5.2.17
Warning: Wrong parameter count for array_fill() in /in/f7QFG on line 5 Warning: Invalid argument supplied for foreach() in /in/f7QFG on line 7 Notice: Undefined variable: temp in /in/f7QFG on line 19 Notice: Undefined variable: data in /in/f7QFG on line 20
Output for 4.3.0 - 4.3.10, 4.4.0 - 5.0.3
Warning: Wrong parameter count for array_fill() in /in/f7QFG on line 5 Warning: Invalid argument supplied for foreach() in /in/f7QFG on line 7 Notice: Undefined variable: temp in /in/f7QFG on line 19 Notice: Undefined variable: data in /in/f7QFG on line 20
Output for 4.3.11
Warning: Wrong parameter count for array_fill() in /in/f7QFG on line 5 Notice: Undefined variable: temp in /in/f7QFG on line 19 Notice: Undefined variable: data in /in/f7QFG on line 20