PHP zip_entry_filesize() Function | Noobz Tutorial
Noobz Tutorial -- Learning not just technology, but also dreams!
PHP zip_entry_filesize() Function
The zip_entry_filesize() function returns the size of a file entry in a ZIP archive.
Syntax
zip_entry_filesize(resource $zip_entry)
Parameters
- $zip_entry: Required. The ZIP entry resource returned by
zip_entry_open().
Return Value
Returns the file size (in bytes) of the ZIP entry on success, or false on failure.
Example
The following example demonstrates how to get the file size of a ZIP entry:
<?php
$zip = zip_open("test.zip");
if ($zip) {
while ($zip_entry = zip_read($zip)) {
echo "File name: " . zip_entry_name($zip_entry) . "<br>";
echo "File size: " . zip_entry_filesize($zip_entry) . " bytes<br>";
}
zip_close($zip);
}
?>
This example opens a ZIP file named test.zip, reads each entry, and outputs its name and size.
YouTip