codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
<?php $data = array( array(0,1), array(0,1), array(0,1), array(0,1), array(0,1), array(0,1), array(0,1), array(0,1), array(0,1), array(0,1), array(0,1), array(0,1), array(0,1), array(0,1), array(0,1) ); // Number of columns $hor_length = 6; $numrows = count($data); // Start of table echo "<table>\n<tr>\n"; // Loop the results with a counter for ($i = 1; $row = array_shift($data); $i++) { // Every iteration echos a cell echo "<td>Id : " . $row[0] . " = " . $row[1] . "</td>\n"; // If we're at the end of a row, echo a row break, unless it is the last result if (!($i % $hor_length) && $i < $numrows) { echo "</tr>\n<tr>\n"; } } // Right-pad the end row with empty cells for ($i--; $i % $hor_length; $i++) { echo "<td></td>\n"; } // Echo the end of the table echo "</tr>\n</table>";
Private
[
?
]
Run code
Submit