SplFileInfo::getSize
(PHP 5 >= 5.1.2, PHP 7, PHP 8)
SplFileInfo::getSize — Gets file size
Опис
public function SplFileInfo::getSize():
int|false
Параметри
У цієї функції немає
параметрів.
Значення, що повертаються
The filesize in bytes on success, or false on failure.
If the file is a symbolic link, the size of the target is returned.
If the target does not exist, a RuntimeException
is thrown.
To obtain the size of the symbolic link itself, use the
size element of the array returned by lstat().
Помилки/виключення
A RuntimeException will be thrown if the file does not exist or an error occurs.
Приклади
Приклад #1 SplFileInfo::getSize() example
<?php
$info = new SplFileInfo('example.jpg');
echo $info->getFilename() . " " . $info->getSize();
?>
Поданий вище приклад виведе щось
схоже на:
Прогляньте також
- filesize() - Gets file size
- lstat() - Gives information about a file or symbolic link