3v4l.org

run code in 300+ PHP versions simultaneously
<?php $i = 0; // menghitung loop $j = 0; // key untuk $data $conton = [1, 2, 3, 4, 5, 6, 7]; foreach($contoh as $c) { $temp[$i] = $c; $i++; if( ($i % 3) == 0) { $data[$j] = $temp[$i]; $j++; } } print_r($temp); print_r($data);

preferences:
59.6 ms | 402 KiB | 5 Q