Thursday, December 16, 2010

Custom number of cloumns in each row

<?php
$array = array('a','b','c','d','e','f','g','h','i','j');
?>
<html>
<head>
<body>
<table>
<tr>
<?php
for($i=0;$i<count($array);$i++) {
    $j = $i+1;
?>
<td><?php echo $array[$i]; ?></td>
<?php if($j%4 == 0) { ?>
</tr>
<tr>
<? }
}
?>