You will have 4 col-md-3 containing as many col-md-12 as you want (articles 1,5,9.. in the first, articles 2, 6, 10... in the second, etc.)
<div class="col-md-3"> # $i % 4 === 1
<div class="col-md-12"><p>Article 1</p></div>
<div class="col-md-12"><p>Article 5</p></div>
...
</div>
<div class="col-md-3"> # $i % 4 === 2
<div class="col-md-12"><p>Article 2</p></div>
<div class="col-md-12"><p>Article 6</p></div>
...
</div>
<div class="col-md-3"> # $i % 4 === 3
<div class="col-md-12"><p>Article 3</p></div>
<div class="col-md-12"><p>Article 7</p></div>
...
</div>
<div class="col-md-3"> # $i % 4 === 0
<div class="col-md-12"><p>Article 4</p></div>
<div class="col-md-12"><p>Article 8</p></div>
...
</div>
This should work:
<div class="container" >
<div class="row">
<?php
$i=0;
$col1="<div class='col-md-3'>";
$col2="<div class='col-md-3'>";
$col3="<div class='col-md-3'>";
$col4="<div class='col-md-3'>";
foreach ($value as $add) {
if($i % 4 === 1) {
$col1 = $col1 ."<div class='col-md-12'><p>".$add->article_item."</p></div>";
}
if($i % 4 === 2) {
$col2 = $col2 ."<div class='col-md-12'><p>".$add->article_item."</p></div>";
}
if($i % 4 === 3) {
$col3 = $col3 ."<div class='col-md-12'><p>".$add->article_item."</p></div>";
}
if($i % 4 === 0) {
$col4 = $col4 ."<div class='col-md-12'><p>".$add->article_item."</p></div>";
}
$i++;
}
$col1 = $col1 . "</div>";
$col2 = $col2 . "</div>";
$col3 = $col3 . "</div>";
$col4 = $col4 . "</div>";
echo $col1 . $col2 . $col3 . $col4;
?>
</div>
First, we init our 4 columns.
Then, for every 4th elements (modulo), we add to the right column the article, contained in a col-md-12.
And then, you close the div then echo them.