I m trying to iterate the foreach loop using array and scheduling it through sleep function.
below is my code:
<?php
$result = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
$get_count = 4;
$delay = 2;
foreach ($result as $row)
{
echo $row."<br>";
$countx++;
if(($countx % $get_count)==0)
{
sleep($delay);
}
}
?>
The output I'm getting is
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
and the output I want is to be show in batch and hide the previos batch :
1
2
3
4
Hide above result and show nxt batch
5
6
7
8
Hide above result and show nxt batch
9
10
11
12
Hide above result and show nxt batch
13
14
15
16
Any help?