3v4l.org

run code in 300+ PHP versions simultaneously
<?php $i = 0; // menghitung loop $j = 0; // key untuk $data $contoh = range(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);

preferences:
40.43 ms | 402 KiB | 5 Q