Re: newline in preg_split

From: Date: Sun, 18 Mar 2001 22:38:03 +0000
Subject: Re: newline in preg_split
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-44459@lists.php.net to get a copy of this message
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 <jeppe@partitur.se> To: <php-general@lists.php.net> 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: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.general (#44459) next »