RE: [PHP] substr() help
| From: | Van Andel, Robbert | Date: | Fri, 07 Feb 2003 17:15:55 +0000 |
| Subject: | RE: [PHP] substr() help | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-134757@lists.php.net to get a copy of this message | ||
Try this
$temp = fgets($fp,4096);
$line = substr($temp,0,10);
Robbert van Andel
-----Original Message-----
From: Paul Reilly [mailto:reilly@wt.net]
Sent: Friday, February 07, 2003 9:06 AM
To: php-general@lists.php.net
Subject: [PHP] substr() help
working on a peice of code that should be pretty easy, but for some reason I
am not getting any results.
I want the first 10 characters of each line from the file I am reading and
am using this code:
$temp = str_replace("\n", "", fgets($fp, 4096));
$line = substr ($temp, 0, 5);
when I test for temp I get 30 responses - which is correct, but when I test
for $line I get Zero responses. Did I make a mistake in my code
Paul Reilly
reilly@wt.net
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php