tdphp/td3/18.php

18 lines
343 B
PHP
Raw Normal View History

2023-03-06 15:21:44 +01:00
<?php
function affiche_tab($tab) {
echo "<table>";
foreach($tab as $cle => $valeur) {
echo "<tr><td>" . $cle . "</td><td>" . $valeur . "</td></tr>";
}
echo "</table>";
}
// Exemple d'utilisation de la fonction
$mon_tab = array(
"nom" => "Dupont",
"prenom" => "Jean",
"age" => 35
);
affiche_tab($mon_tab);