SplFileInfo::getSize

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

SplFileInfo::getSizeGets file size

Descrizione

public SplFileInfo::getSize(): int|false

Returns the filesize in bytes for the file referenced.

Elenco dei parametri

Questa funzione non contiene parametri.

Valori restituiti

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

Errori/Eccezioni

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

Esempi

Example #1 SplFileInfo::getSize() example

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

Il precedente esempio visualizzerà qualcosa simile a:

example.jpg 15385

Vedere anche: