note 39955 deleted from function.fwrite by irchtml
| From: | irchtml@php.net | Date: | Mon, 23 Feb 2004 07:59:08 +0000 |
| Subject: | note 39955 deleted from function.fwrite by irchtml | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-65567@lists.php.net to get a copy of this message | ||
Note Submitter: Bojan Mauser
----
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.