PHP zip_entry_compressionmethod() Function
Example
Open a ZIP file archive and get the name and compression method 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
compression method
echo "Compression method: " . zip_entry_compressionmethod($zip_entry);
echo "</p>";
}
zip_close($zip);
}
?>
The output of the code depends on the contents of the ZIP archive:
Name: ziptest.txt
Compression method: deflated
Name: htmlziptest.html
Compression method: deflated
Definition and Usage
The zip_entry_compressionmethod() function returns the compression method of a ZIP directory entry.
Syntax
zip_entry_compressionmethod(zip_entry)
Parameter Values
Parameter | Description |
---|---|
zip_entry | Required. Specifies the ZIP directory entry returned by zip_read() |
Technical Details
Return Value: | The compression method |
---|---|
PHP Version: | 4.1.0+ |
❮ PHP Zip Reference