Fastest way to calculate the size of an file opened inside the code (PHP) -



Fastest way to calculate the size of an file opened inside the code (PHP) -

i know there quite bit of in-built functions available in php size of file, of them are: filesize, stat, ftell, etc.

my question lies around ftell quite interesting, returns integer value of file-pointer file.

is possible size of file using ftell function? if yes, tell me how?

scenario:

system (code) opens existing file mode "a" append contents. file pointer points end of line. system updates content file. system uses ftell calculate size of file.

fstat determines file size without acrobatics:

$f = fopen('file', 'r+'); $stat = fstat($f); $size = $stat['size'];

ftell can not used when file has been opened append("a") flag. also, have seek end of file fseek($f, 0, seek_end) first.

php file filesize

Comments

Popular posts from this blog

java - How to pass parameters between Request-Scoped Controllers? -

actionscript 3 - Flex: moving a point with rotation doesnt change the point XY? -

string - what is the difference between "some" == "some\0" and strcmp("some","some\0") in c++? -