(PHP 5 >= 5.1.2, PHP 7, PHP 8)
SplFileInfo::getSize — Gets file size
Returns the filesize in bytes for the file referenced.
This function has no parameters.
The filesize in bytes on success, or false
on failure.
A RuntimeException will be thrown if the file does not exist or an error occurs.
Example #1 SplFileInfo::getSize() example
<?php
$info = new SplFileInfo('example.jpg');
echo $fileinfo->getFilename() . " " . $fileinfo->getSize();
?>
The above example will output something similar to:
example.jpg 15385