22 lines
561 B
PHP
Executable file
22 lines
561 B
PHP
Executable file
<?php
|
|
|
|
$donnees = array(
|
|
"Jean" => array(
|
|
"nom" => "Dupont",
|
|
"email" => "jean.dupont@outlook.com"
|
|
),
|
|
"Pierre" => array(
|
|
"nom" => "Martin",
|
|
"email" => "p.mart1@gmail.com"
|
|
),
|
|
"Paul" => array(
|
|
"nom" => "Durand",
|
|
"email" => "durandpaul@caramail.fr"
|
|
),
|
|
);
|
|
|
|
foreach ($donnees as $prenom => $info) {
|
|
$data = $prenom . " " . $info["nom"] . " " . $info["email"];
|
|
file_put_contents("data1.txt", $data . PHP_EOL, FILE_APPEND);
|
|
echo "Ecriture de $prenom dans le fichier data1.txt<br/>";
|
|
}
|