fork(1) download
  1. <?php
  2. $count = 10;
  3. $group = 4;
  4.  
  5. for ( $i = 1; $i <= $count; ++$i ) {
  6. if ( ( $i - 1 ) % $group == 0 ) echo '<div class="row">'."\n";
  7. echo "\t<span>$i</span>\n";
  8. if ( $i == $count || $i % $group == 0 ) echo "</div>\n";
  9. }
  10. ?>
  11.  
Success #stdin #stdout 0.03s 52480KB
stdin
Standard input is empty
stdout
<div class="row">
	<span>1</span>
	<span>2</span>
	<span>3</span>
	<span>4</span>
</div>
<div class="row">
	<span>5</span>
	<span>6</span>
	<span>7</span>
	<span>8</span>
</div>
<div class="row">
	<span>9</span>
	<span>10</span>
</div>