To unzip a zip file in PHP you can use the following snippet.

Sample PHP

function Unzip($filename, $destination){
	$zip = new ZipArchive() ;
	if ($zip->open($filename) !== TRUE) {
		die ('Could not open archive file');
	}
	$zip->extractTo($destination);
	$zip->close();
	echo 'Archive successfully extracted to directory';
}

3 thought on “How to unzip a zip file in PHP”

Leave a Reply