tdphp/10.php

28 lines
494 B
PHP
Raw Permalink Normal View History

2023-03-06 15:21:44 +01:00
<?php
$tableau = array(
"nom" => "nunes",
"prenom" => "Jean-Claude",
"age" => 18,
"addresse" => "35400 Saint-Malo",
"profession" => "Java",
);
echo "<hr><h1>FOR :</h1>";
for ($i = 0; $i < count($tableau); $i++) {
print(array_keys($tableau)[$i] . ": ");
echo $tableau[array_keys($tableau)[$i]] . "<br/>";
}
echo "<hr><h1>PRINT_R :</h1>";
print_r($tableau);
echo "<hr><h1>FOREACH :</h1>";
foreach ($tableau as $key => $value) {
echo "$key: $value<br/>";
}