I am trying to get value like 1-2-1-2-1-2 from for loop
I tried code like this
$c = count($response['video']); // 2
$currentPage = 2;
$k = 1;
for ($i=$k; $i <= $currentPage ; $i++) {
$b = $i > $c ? $k : $i;
$urls = $response['video'][$b - 1];
echo "$b";
}
where $currentPage = 5; $c =2;
when $c = 3; the value should be 1-2-3-1-2-3 when i echo $b or dd($b) out of loop i will got 12111 but i need answer 121212 please help me to solve this.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire