zip_entry_filesize – Retrieve the Actual Size of a Zip Directory Entry (PHP)
The PHP function zip_entry_filesize returns the actual size of a zip archive directory entry, takes a zip_entry resource obtained from zip_read(), and can be used together with zip_entry_name in example code to list file names and their original sizes.
Function Signature int zip_entry_filesize(resource $zip_entry)
Description Returns the actual size of the specified directory entry within a zip archive.
Parameter $zip_entry – a directory entry resource returned by zip_read() .
Return Value The size (in bytes) of the directory entry.
Example The following PHP script demonstrates opening a zip file, iterating over its entries, and printing each entry’s name and original size using zip_entry_name and zip_entry_filesize :
<?php $zip = zip_open("test.zip"); if ($zip) { while ($zip_entry = zip_read($zip)) { echo "<p>"; echo "Name: " . zip_entry_name($zip_entry) . "<br />"; echo "Original size: " . zip_entry_filesize($zip_entry) . ";"; echo "</p>"; } zip_close($zip); } ?>
Laravel Tech Community
Specializing in Laravel development, we continuously publish fresh content and grow alongside the elegant, stable Laravel framework.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.