mardi 22 décembre 2020

get value 1 - 2 - 1 - 2 - 1 in for loop php

i am trying to get value like 1-2-1-2-1-2 from for loop

i tried code like this

$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; remember when $c = 3; the the value should be 1-2-3-1-2-3 please help me to solve this.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire