|
|
|
|
Bonjour,
svp j'ai un problème concernant un exercice que j'ai trouvé
le principe d'afficher une table de multiplication
sous forme de lignes et colonne
voici annoncé
Écrire un programme qui affiche la table de multiplication totale de {1,...,12} par {1,...,12}.
voici l'exemple se trouve dans ce site www.grappa.univ-lille3.fr\polys\php\exemples\multiplicationtotale.html
Exemple : multiplicationtotale.php
Configuration: Windows XP Firefox 2.0.0.14
Bonjour.
|
Répondre à stitox
|
Voici un code qui fait ce que tu demande :
<?php
$table = range(0,12);
$tabGlobal = array();
foreach ($table as $values){
$tab = array();
foreach($table as $val){
$tab [] = $values * $val;
}
$tabGlobal[] = $tab;
}
?>
<html>
<body>
<table border="1">
<tr>
<th></th>
<?php foreach ($table as $val){?>
<th width="20"><?php echo $val;?></th>
<?php } ?>
</tr>
<?php $z = 0;
foreach($tabGlobal as $valeur){?>
<tr>
<td><?php echo $z;?></td>
<?php foreach($table as $value){?>
<td><?php echo $valeur[$value];?></td>
<?php } ?></tr> <?php ++$z;} ?>
</table>
</body>
</html>
|
Mais à tous enfin j'ai arriver à résoudre le problème
|