I'm new to this (of course)
I would like to add a break after every third item when I print my array.
I'm thinking this calls for a for() and an augment of some sort.
I've looked through the manual and this board for pointers, but maybe a bit too new to see exactly what I need and how to implement it
Thx
inserting <br> after every third array item
Moderator: General Moderators
i.e.or
Code: Select all
$c=0;
foreach($array as $entry)
{
print($entry);
if( ++$c==3 )
{
print('<br/>');
$c=0;
}
}Code: Select all
$c = count($array);
for($i=0; $i!=count($c);$i++)
{
if( ($i % 3) == 0 && $i != 0)
print('<br/>');
print($arrayї$i]);
}Code: Select all
$c = sizeof($arr);
for($i = 0; $i < $c ; ++$i)
{
echo $arrї$i];
(($i % 3 )== 0 ) ? print("<br>\n") : print(" ");
}Code: Select all
(($i % 3 )== 0 )