← All built-ins / filesize()

filesize()

filesize(string $s): int

Parameters

NameTypeDescription
$pathstringfile path

Return value

File size in bytes.

Example

file_put_contents("/tmp/hphp_doc_s.txt", "12345");
echo filesize("/tmp/hphp_doc_s.txt");
unlink("/tmp/hphp_doc_s.txt");
5

See also

file_exists()file_get_contents()