27 lines
494 B
PHP
27 lines
494 B
PHP
<?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/>";
|
|
}
|