How to display two table columns per row in php loop
You can use array_chunk() to split an array of data into smaller arrays, in this case of length 2, for each row. <table> <?php foreach (array_chunk($values, 2) as $row) { ?> <tr> <?php foreach ($row as $value) { ?> <td><?php echo htmlentities($value); ?></td> <?php } ?> </tr> <?php } ?> </table> Note that if you … Read more