Problemas con foreach y array al llenar datos de una tabla
Publicado por Brayan (5 intervenciones) el 26/09/2021 04:13:01
Hola me podrían ayudar es un ejercicio que tengo que hacer y ya no tengo idea de como seguir mirar punto 3 de la imagen. Gracias de antemano:
<body>
<?php
$usuarios = array{
'Juan Pérez' => array {'Direccion' => Cra. 45 N° 45 -56 'Telefono' => 3456789 'fecha de cumpleaños' =>23/12/1997 'significado' => Amarillo Riqueza y alegría},
'Pablo Manrique' => array {'Direccion' => Cra. 45 N° 45 -56 'Telefono' => 3456789 'fecha de cumpleaños' => 23/12/1997 'significado' => Amarillo Riqueza y alegría},
'Nancy Peña' => array {'Direccion' => Cra. 45 N° 45 -56 'Telefono' => 3456789 'fecha de cumpleaños' =>23/12/1997 'significado' => Amarillo Riqueza y alegría},
};
?>
<table border= '2'>
<tr>
<th>USUARIO</th>
<th>DIRECCION</th>
<th>TELEFONO</th>
<th>FECHA DE CUMPLEAÑOS</th>
<th>COLOR FAVORITO</th>
<th>SIGNIFICADO</th>
</tr>
<?php
foreach($usuarios as $nombre => $datos){
echo '<tr>';
echo '<td>' .$nombre.'</td>';
echo '<tr>';
}
?>
</table>
</body>

<body>
<?php
$usuarios = array{
'Juan Pérez' => array {'Direccion' => Cra. 45 N° 45 -56 'Telefono' => 3456789 'fecha de cumpleaños' =>23/12/1997 'significado' => Amarillo Riqueza y alegría},
'Pablo Manrique' => array {'Direccion' => Cra. 45 N° 45 -56 'Telefono' => 3456789 'fecha de cumpleaños' => 23/12/1997 'significado' => Amarillo Riqueza y alegría},
'Nancy Peña' => array {'Direccion' => Cra. 45 N° 45 -56 'Telefono' => 3456789 'fecha de cumpleaños' =>23/12/1997 'significado' => Amarillo Riqueza y alegría},
};
?>
<table border= '2'>
<tr>
<th>USUARIO</th>
<th>DIRECCION</th>
<th>TELEFONO</th>
<th>FECHA DE CUMPLEAÑOS</th>
<th>COLOR FAVORITO</th>
<th>SIGNIFICADO</th>
</tr>
<?php
foreach($usuarios as $nombre => $datos){
echo '<tr>';
echo '<td>' .$nombre.'</td>';
echo '<tr>';
}
?>
</table>
</body>
Valora esta pregunta


0