3v4l.org

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

preferences:
43.1 ms | 402 KiB | 5 Q