Hello,

If you read the file with file()-function, you can get as a result an array which 
includes each row of the file.

For example:
$rows = file("c:\thisfile.txt");

echo $rows[0];
echo $rows[1];
echo $rows[2];

The result should be now like following:
core 010105
business 070344
core 020202

Note that also \n and \r -characters are included to the array.

Cheers,
- Ville


----- Original Message ----- 
From: Jesper Blomström <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, March 19, 2001 12:31 AM
Subject: [PHP] newline in preg_split


> Hi!
> 
> I have text file looking something like this:
> 
> core 010105
> business 070344
> core 020202
> ...
> 
> 
> The textfile is a result from a database question and I am trying to parse
> the file in order to retrieve each line. I have tried using the
> explode()-method but I can´t get it to work with the delimiter \n (or \r or
> \\n...).
> I have also tried to use the preg_split()-method which takes a RE-argument
> but that doesn´t seem to work either (have tried in a lot of ways).
> 
> Can anyone give me a clue how to solve this problem?
> 
> Many thanks from Stockholm, Sweden!
> 
> Jesper Blomstroem
> 
> 
> 
> --
> 
> Jesper Blomström
> 08-370 317 (Hem)
> 08-566 280 08 (Arbete)
> 070-3024911
> 
> Ångermannagatan 113
> 162 64 Vällingby
> 
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to