PHP 8.5.0 Alpha 4 available for testing

Voting

: two minus one?
(Example: nine)

The Note You're Voting On

php at yurgon dot de
5 years ago
<?php
// Quick example to test the return value in order to tell a 0 byte file from a failed call to filesize()

$size = filesize("some.file");

if (
$size === FALSE) {
echo
"filesize not available";
} else {
echo
"some.file is $size bytes long";
}

// A shorter version, slightly different
if ( ($size = filesize("some.file")) !== FALSE)
echo
"some.file is $size bytes long";
?>

<< Back to user notes page

To Top