<?php $miArray = [3, 4, "pepe", [53, 4, 5], false]; $miArray = [[1, 2], [3, 4]]; function pintaArray($array) { ?> <table border="1"> <?php foreach ($array as $valor) { if (!is_array($valor)) { $valor = [$valor]; } ?> <tr> <?php foreach ($valor as $v) { ?> <td><?= $v ?></td> <?php } ?> </tr> <?php } ?> </table> <?php } pintaArray($miArray); ?>