note 42847 added to function.file-get-contents

From: Date: Mon, 31 May 2004 22:49:17 +0000
Subject: note 42847 added to function.file-get-contents
Groups: php.notes 
Request: Send a blank email to php-notes+get-70369@lists.php.net to get a copy of this message
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. ---- Manual Page -- http://www.php.net/manual/en/function.file-get-contents.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+42847 Delete -- http://master.php.net/manage/user-notes.php?action=delete+42847&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+42847&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#70369) next »