RE: [PHP-WIN] Reading in text file characters
| From: | Mikey | Date: | Wed, 15 Jan 2003 15:42:00 +0000 |
| Subject: | RE: [PHP-WIN] Reading in text file characters | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-17886@lists.php.net to get a copy of this message | ||
You could try using the substr() function, it will take any number of chars
from any place in a string. However, I think you could have found this had
you been bothered to look in the manual first...
HTH,
Mikey
> -----Original Message-----
> From: Nichols, Mark A. [mailto:markn@spicergroup.com]
> Sent: 15 January 2003 15:17
> To: php-windows@lists.php.net
> Subject: [PHP-WIN] Reading in text file characters
>
>
> The following code reads in a text file one line at a time.
>
>
>
> for ($k=0; $k<=count($readfile)-1; $k++) {
>
> $fields = split("\t",$readfile[$k]);
>
> echo nl2br("$fields[0]<br>");
>
>
>
> }
>
>
>
> The problem is that it seems to strip the empty spaces out.
>
>
>
> My text file is formatted by lengths. I need to read the first 25
> characters from the text file. Then read 50 more... And so on.
>
>
>
> Can anyone give my the code for reading in a certain number of
> characters from a text file.
>
>
>
> Thank you in advance.
>
>