18 lines
343 B
PHP
18 lines
343 B
PHP
|
<?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);
|