Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <table width="100%" border=1>
- <tr>
- <?php
- $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
- $count = 0;
- $bilderProReihe = 5;
- foreach($array as $element) { // oder while
- if($count < $bilderProReihe) {
- $count++;
- } else {
- echo '</tr><tr>';
- $count = 1;
- }
- echo '<td width="'.(100 / $bilderProReihe).'%">'.$element.'</td>';
- }
- $remainingCells = $bilderProReihe - $count;
- echo '<td colspan="'.$remainingCells.'"> </td>';
- ?>
- </tr>
- </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement