PHP zip_entry_compressedsize() Function

❮ PHP Zip Reference

Example

Open a ZIP file archive and get the name and compressed size of the directory entries:

<?php
$zip = zip_open("test.zip");

if ($zip) {
  while ($zip_entry = zip_read($zip)) {
    echo "<p>";
    // Get name of directory entry
    echo "Name: " . zip_entry_name($zip_entry) . "<br>";
    // Get compressed size
    echo "Compressed size: " . zip_entry_compressedsize($zip_entry);
    echo "</p>";
  }
  zip_close($zip);
}
?>

The output of the code depends on the contents of the ZIP archive:

Name: ziptest.txt
Compressed size: 56

Name: htmlziptest.html
Compressed size: 101


Definition and Usage

The zip_entry_compressedsize() function returns the compressed file size of a ZIP directory entry.

Syntax

zip_entry_compressedsize(zip_entry)

Parameter Values

Parameter Description
zip_entry Required. Specifies the ZIP directory entry returned by zip_read()

Technical Details

Return Value: The compressed size
PHP Version: 4.1.0+

❮ PHP Zip Reference
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.