note 34958 added to function.fread

From: Date: Wed, 13 Aug 2003 09:48:41 +0000
Subject: note 34958 added to function.fread
Groups: php.notes 
Request: Send a blank email to php-notes+get-54063@lists.php.net to get a copy of this message
An example above is wrong! <?php $handle = fopen ("http://www.php.net/", "rb"); $contents = ""; do { $data = fread ($handle, filesize ($filename)); if (strlen($data) == 0) { break; } $contents .= $data; } fclose ($handle); ?> Should read: <?php $handle = fopen ("http://www.php.net/", "rb"); $contents = ""; do { $data = fread ($handle, 1024)); $contents .= $data; } while (strlen($data) > 0); fclose ($handle); ?> -- Jamie Burns SSL Certificates from http://www.bluessl.com/ ---- Manual Page -- http://www.php.net/manual/en/function.fread.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+34958 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+34958&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+34958&report=yes

« previous php.notes (#54063) next »