[ create a new paste ] login | about

Link: http://codepad.org/21m4Rxb5    [ raw code | output | fork ]

PHP, pasted on Aug 14:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php
$rows = range(0, 20);

$lastKey = end(array_keys($rows));

foreach ($rows as $k => $row) {
	if (!($k % 3)) {
		echo '<div class="row-fluid">'.PHP_EOL;
	}
	echo '<div class="span4">span4</div>'.PHP_EOL;
	
	if (!(($k + 1) % 3) || $k == $lastKey) {
		echo '</div>'.PHP_EOL;
	}
}
?>


Output:
<div class="row-fluid">
<div class="span4">span4</div>
<div class="span4">span4</div>
<div class="span4">span4</div>
</div>
<div class="row-fluid">
<div class="span4">span4</div>
<div class="span4">span4</div>
<div class="span4">span4</div>
</div>
<div class="row-fluid">
<div class="span4">span4</div>
<div class="span4">span4</div>
<div class="span4">span4</div>
</div>
<div class="row-fluid">
<div class="span4">span4</div>
<div class="span4">span4</div>
<div class="span4">span4</div>
</div>
<div class="row-fluid">
<div class="span4">span4</div>
<div class="span4">span4</div>
<div class="span4">span4</div>
</div>
<div class="row-fluid">
<div class="span4">span4</div>
<div class="span4">span4</div>
<div class="span4">span4</div>
</div>
<div class="row-fluid">
<div class="span4">span4</div>
<div class="span4">span4</div>
<div class="span4">span4</div>
</div>


Create a new paste based on this one


Comments: