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

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -