SplFileInfo::getSize

(PHP 5 >= 5.1.2, PHP 7, PHP 8)

SplFileInfo::getSizeGets file size

Beschreibung

public SplFileInfo::getSize(): int|false

Returns the filesize in bytes for the file referenced.

Parameter-Liste

Diese Funktion besitzt keine Parameter.

Rückgabewerte

The filesize in bytes on success, or false on failure.

Fehler/Exceptions

A RuntimeException will be thrown if the file does not exist or an error occurs.

Beispiele

Beispiel #1 SplFileInfo::getSize() example

<?php
$info
= new SplFileInfo('example.jpg');
echo
$fileinfo->getFilename() . " " . $fileinfo->getSize();
?>

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

example.jpg 15385

Siehe auch