1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
$output = array();
// open file for reading
if(!($myFile = fopen($this->fichier, "r")))
{
print("Error:");
print("$this->fichier est impossible à lire\n");
exit;
}
while(!feof($myFile))
{
//read a line from the file
$ligne = fgets($myFile, 255);
preg_match($rechercher, $ligne, $matches);
if(!empty($matches)){
array_push($output,$matches[1]);
//ici c'est ok
echo $matches[1]. "\n" ;
//ici c'est ok
print_r($output);
}
}
//close the file
fclose($myFile);
//Ici ça n'imprime rien
print_r($output); |
Partager