Loop For Notification

How TO loop Every 50 Lenght
 avatar
unknown
php
4 years ago
1.8 kB
6
Indexable
<!DOCTYPE html>
<html>
<body>

<?php
$items=[1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10,3,4,5,6,7,8,9,10,3,4,5,6,7,8,9,10,6,7,8,9,10,3,4,5,6,7,8,9,10,6,7,8,9,10,3,4,5,6,7,8,9,10,6,7,8,9,10,3,4,5,6,7,8,9,10,6,7,8,9,10,3,4,5,6,7,8,9,10,6,7,8,9,10,3,4,5,6,7,8,9,10,6,7,8,9,10,3,4,5,6,7,8,9,10,6,7,8,9,10,3,4,5,6,7,8,9,10,6,7,8,9,10,3,4,5,6,7,8,9,10,6,7,8,9,10,3,4,5,6,7,8,9,10,6,7,8,9,10,3,4,5,6,7,8,9,10,6,7,8,9,10,3,4,5,6,7,8,9,10,6,7,8,9,10,3,4,5,6,7,8,9,10,6,7,8,9,10,3,4,5,6,7,8,9,10,6,7,8,9,10,3,4,5,6,7,8,9,10,6,7,8,9,10,3,4,5,6,7,8,9,10,6,7,8,9,10,3,4,5,6,7,8,9,10,6,7,8,9,10,3,4,5,6,7,8,9,10,6,7,8,9,10,3,4,5,6,7,8,9,10,6,7,8,9,10,3,4,5,6,7,8,9,10,6,7,8,9,10,3,4,5,6,7,8,9,10,6,7,8,9,10,3,4,5,6,7,8,9,10,6,7,8,9,10,3,4,5,6,7,8,9,10,6,7,8,9,10,3,4,5,6,7,8,9,10,6,7,8,9,10,3,4,5,6,7,8,9,10,6,7,8,9,10,3,4,5,6,7,8,9,10,6,7,8,9,10,3,4,5,6,7,8,9,10,6,7,8,9,10,3,4,5,6,7,8,9,10,6,7,8,9,10,3,4,5,6,7,8,9,10,6,7,8,9,10,3,4,5,6,7,8,9,10,6,7,8,9,10,3,4,5,6,7,8,9,10,6,7,8,9,10,3,4,5,6,7,8,9,10,6,7,8,9,10,3,4,5,6,7,8,9,10,6,7,8,9,10,3,4,5,6,7,8,9,10,6,7,8,9,10,3,4,5,6,7,8,9,10,6,7,8,9,10,3,4,5,6,7,8,9,10,6,7,8,9,10,3,4,5,6,7,8,9,10,6,7,8,9,10,3,4,5,6,7,8,9,10,6,7,8,9,10,3,4,5,6,7,8,9,10,6,7,8,9,10,3,4,5,6,7,8,9,10,6,7,8,9,10,3,4,5,6,7,8,9,10,6,7,8,9,10,3,4,5,6,7,8,9,10,6,7,8,9,10,3,4,5,6,7,8,9,10];

$TotalCount=count($items);
$freq=50;
$getSisaBagi=$TotalCount%$freq;
echo $getSisaBagi;
$arraySplit=[];
foreach ($items as $index => $item){
    echo "<li> ".$item;
    array_push($arraySplit,$item);
    if($index % $freq  == ($freq-1)){
      echo "<br>";
      print_r($arraySplit);
      echo  "my message \n";
      $arraySplit = array(); 
    }
}
print_r(array_slice($items, -$getSisaBagi));

?>

</body>
</html>
Editor is loading...