note 69281 deleted from function.clearstatcache by bjori

From: Date: Sun, 10 Sep 2006 13:54:47 +0000
Subject: note 69281 deleted from function.clearstatcache by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-116985@lists.php.net to get a copy of this message
Note Submitter: admin at ethisoft dot nl ---- function also affects calls to fopen and fread. example: if file.ext is a empty file, <?php $handle = fopen('file.ext','ab+'); $result = fwrite($handle, 'data to add to file'); fclose($handle); $handle = fopen('file.ext', "rb"); $contents = fread($handle, filesize('file.ext')); fclose($handle); // $contents will be empty!! ?> BUT, <?php $handle = fopen('file.ext','ab+'); $result = fwrite($handle, 'data to add to file'); fclose($handle); clearstatcache(); $handle = fopen('file.ext', "rb"); $contents = fread($handle, filesize('file.ext')); fclose($handle); // $contents will contain: data to add to file ?>

« previous php.notes (#116985) next »