note 42847 deleted from function.file-get-contents by tomsommer
| From: | tomsommer@php.net | Date: | Mon, 31 May 2004 23:30:05 +0000 |
| Subject: | note 42847 deleted from function.file-get-contents by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-70373@lists.php.net to get a copy of this message | ||
Note Submitter: benjcarson@digitaljunkies.ca
----
In regards mattsoft's example: an empty string evaluates to false, so you should probably use
!== instead:
<?php
if ( ($file = file_get_contents($uri)) !== false ) {
// do stuff
} else {
// No good
}
?>
This is preferable to is_readable(), because is_readable() doesn't work for some streams.