There are 2 ways to the size of a file with PHP.
- PHP function filesize() returning the file size in bytes:
$bytes = filesize('log.txt'); // $bytes now contains the size of the file log.txt in bytes
- PHP function stat() returning an array of information about the file including the size of it, also in bytes:
$loginfo = stat('log.txt'); echo $loginfo['size']; // output the size of the file in bytes