paulomartinhago
11/28/2013 - 5:20 PM

printf-rows.php

<?php

$li    = '<li>%s</li>';
$i     = 1;
$rows  = 4;
$total = 5;

while( $i <= $total ) {
    $html .= '<article>CONTEÚDO</article>';

    if( $i % $rows == 0 || $total == $i ){
        printf($li, $html);
        $html = '';
    }

    $i++;
}