$fh = fopen('/path/fichier.txt', 'r') or die($php_errormsg); while (!feof($fh)) { $line = fgets($fh, 4096); if (preg_match($pattern, $line)) { $result[ ] = $line; } } fclose($fh); print_r($result)