|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-08-23 10:53 UTC] cmb@php.net
-Status: Open
+Status: Not a bug
-Assigned To:
+Assigned To: cmb
[2016-08-23 10:53 UTC] cmb@php.net
[2016-08-23 12:26 UTC] frank123m at gmail dot com
[2016-08-23 12:43 UTC] frank123m at gmail dot com
[2016-08-23 15:10 UTC] requinix@php.net
-Package: Math related
+Package: Filesystem function related
[2016-08-23 15:10 UTC] requinix@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 11:00:01 2025 UTC |
Description: ------------ function hit_count() { $filename = 'count.txt'; $handle = fopen($filename, 'r'); $current = fread($handle, filesize($filename)); fclose($handle); $current_inc = $current + 1; $handle = fopen($filename, 'w'); fwrite($handle, $current_inc); fclose($handle); $handle = fopen($filename, 'r'); $current = fread($handle, filesize($filename)); fclose($handle); echo $current; } Test script: --------------- count.txt: example: 99->100 echo $current will show 10 instead of 100. filesize($filename) remain the same after fwrite. its the bug.