I use the following code to output content of an array:
$txt = sprintf("%s %s %s %s %s %s %s", $myarray[1], $myarray[2], $myarray[3], $myarray[4], $myarray[5], $myarray[6], $myarray[7]);
echo $txt;
echo "<br />";
$txt = sprintf("%s %s %s %s %s %s %s", $myarray[8], $myarray[9], $myarray[10], $myarray[11], $myarray[12], $myarray[13], $myarray[14]);
echo $txt;
echo "<br />";
$txt = sprintf("%s %s %s %s %s %s %s", $myarray[15], $myarray[16], $myarray[17], $myarray[18], $myarray[19], $myarray[20], $myarray[21]);
echo $txt; here
Now I want to loop it, I tried something like this:
for($a=1, $b=2, $c=3, $d=4, $e=5, $f=6, $g=7; $i<=count($myarray); $a,$b,$c,$d,$e,$f,$g +=7)
{
$txt = sprintf("%s %s %s %s %s %s %s", $myarray[$a], $myarray[$b], $myarray[$c], $myarray[$d], $myarray[$e], $myarray[$f], $myarray[$g]);
echo $txt;
}
but unfortunately it does not work.
PHP array_chunk()
+PHP implode()