I have a multidimensional array that I want to break into 6 div columns, and I can't seem to do it so any help with this ?
Here's the array :
Array
(
[0] => Array
(
[id] => 17
[title] => White
[ref] => 24941
)
[1] => Array
(
[id] => 18
[title] => Blue
[ref] => 11395
)
[2] => Array
(
[id] => 19
[title] => Red
[ref] => 11394
)
.
.
.
and here's my foreach loop
:
echo '<div class="row">';
echo '<div class="col-xs-2">';
$i = 1;
foreach ($colors as $key => $value) {
if ($i % 6 === 0) {
echo $value['title']. 'Ref: '. $value['ref']
}
echo '</div><div class="col-xs-2">';
$i++;
}
echo '</div>';
echo '</div>';
Much appreciated.