Skip to content

Instantly share code, notes, and snippets.

@mnoskov
Created December 8, 2020 09:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mnoskov/93c13af4755ca9818a38ae4bac3d9584 to your computer and use it in GitHub Desktop.
Save mnoskov/93c13af4755ca9818a38ae4bac3d9584 to your computer and use it in GitHub Desktop.
Unzip
<?php
if (!class_exists('ZipArchive')) {
echo 'ZipArchive not available!';
}
ini_set('memory_limit', -1);
ini_set('display_errors', 1);
error_reporting(E_ALL);
$zip = new ZipArchive;
$files = glob('*.zip');
foreach ($files as $file) {
$handle = $zip->open($file);
if ($handle) {
$zip->extractTo(__DIR__);
$zip->close();
echo $file . " unzipped\n";
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment