note 39955 added to function.fwrite
| From: | BojanMauser at rn2 dot php dot net | Date: | Mon, 16 Feb 2004 23:07:03 +0000 |
| Subject: | note 39955 added to function.fwrite | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-65240@lists.php.net to get a copy of this message | ||
You should check if file is written like this:
if (fwrite ($handle, $somecontent) !== FALSE)
echo 'OK file is written';
else
echo 'Error. Cannot write to file';
Use !== operator cause if string $somecontent is empty you will get your error message hence else
part of 'if' statement will be executed. That is because fwrite() returns 0 cause zero
bytes is written, but in case of error returns FALSE.
----
Manual Page -- http://www.php.net/manual/en/function.fwrite.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+39955
Delete -- http://master.php.net/manage/user-notes.php?action=delete+39955&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+39955&report=yes
Search -- http://master.php.net/manage/user-notes.php