echo "\t\t<th>Índices</th><th>Valores</th>\n"; echo "\t</tr>\n"; foreach ($array as $i => $v) { echo "\t<tr style='border:1px solid black'>\n"; echo "\t\t<td style='background-color:gray'>{$i}</td>"; echo "\t\t<td>{$v}</td>\n"; echo "\t</tr>\n"; } echo "</table>"; } ?> <!doctype html> <html lang="es"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <?php //Prueba $localidades = array("Palencia" => 8000, "Valladolid" => 306000, "Murcia" => 439000, "Albacete" => 170000, "Barcelona" => 160000, "A Coruña" => 25000); dibujar($localidades); echo "<br>"; $simbolos = array("Au" => "Oro", "Ag" => "Plata", "Hg" => "Mercurio", "H" => "Hidrógeno"); dibujar($simbolos); ?> </body> </html>
?> <form method='post'> <input name='valor' /> <input type='hidden' name='palabra' value="<?php echo $palabra; ?> " /> <input type='hidden' name='incognita' value='<?php echo serialize($incognita); ?> ' /> <input type='hidden' name='seEncuentra' value="<?php echo 0; ?> " /> <input type='hidden' name='intentosFallidos' value="<?php echo $intentosFallidos; ?> " /> <input type='submit' value='adivinar' /> </form> <img src="<?php echo dibujar($intentosFallidos); ?> " width="256" height="200" /> <a href='logica.php'>Reiniciar</a>