filesize()The file name is given as input and we can get the size of the file in bytes by using filesize function in PHP
echo filesize('test.htm');Output is
Size of all files of directoryHere is an example to display all files sizes along with the file name of current directory. We used scandir function to list all the files.
$ar=scandir('.'); // current dir