Skip to content

Instantly share code, notes, and snippets.

Last active December 14, 2015 10:37
What would you like to do?
Find total uncompressed size of a zip archive
#!/usr/bin/env php
$zip = new ZipArchive();
if ($zip->open('') === true) {
function getTotalUncompressedSize(ZipArchive $zip)
$totalSize = 0;
for ($i = 0; $i < $zip->numFiles; $i++) {
$fileStats = $zip->statIndex($i);
$totalSize += $fileStats['size'];
return $totalSize;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment