note 48175 added to function.fwrite

From: Date: Tue, 14 Dec 2004 17:14:51 +0000
Subject: note 48175 added to function.fwrite
Groups: php.notes 
Request: Send a blank email to php-notes+get-81785@lists.php.net to get a copy of this message
Concerning ceilingfish's post below: Whereas fwriting a blank string returns 0, a failed fwrite returns FALSE. This can be distinguished by using === as in the example in the main documentation. (To avoid confusion, I added a missing bracket too) Thus, the code posted should read: <?php $blank = ''; if(fwrite($somefilehandle,$blank,strlen($blank)) === FALSE) { die 'Some write error'; } else { echo "'$hi' written to file"; } ?> ---- Manual Page -- http://www.php.net/manual/en/function.fwrite.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+48175 Delete -- http://master.php.net/manage/user-notes.php?action=delete+48175&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+48175&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+48175&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+48175&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+48175&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+48175&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+48175&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#81785) next »