Quote:
Originally Posted by sunfighter
Actually it does reflect the multiple additional entries. You took the heart of the while loop out of play. Why did you do this????
|
Why did I do this? Because I should have known better than to do this late in the evening. Indeed, it is working:
PHP Code:
<?php
$groupsize = 4; // OR WHAT EVER NUMBER YOU WANT
$cart = array("Apple","Pear","Banana","Peach","Orange","Coconut","Melon","Berries","Watermelon");
$test = $cart;
$count = 1;
while(count($cart) % $groupsize != 0) {
$cart = array_merge($cart, $test); // $TEST WILL ALWAYS BE THE SAME BEGING ARRAY
$count++;
}
$i=0;
foreach ($cart as $row):
$i++;
$rows .= $row."\n";
if ($i % $groupsize == 0){
$rows .= '-<br/>';
}
endforeach;
echo '<h2>Amended List</h2><pre>'.$rows.'</pre>';
echo sizeof($cart);
$rows = '';
foreach ($test as $row):
$rows .= $row."\n";
endforeach;
echo '<h2>Original List</h2><pre>'.$rows.'</pre>';
echo sizeof($test);
?>
Thanks again, and appologies for not noticing that mistake myself.