To Unzip a zip file in PHP :
PHP has built-in extensions for unzipping the compressed files. We can make use of ZipArchive for to unzip a file.

Example :


// file to unzip
$file = "";

$zip = new ZipArchive;
$res = $zip->open($file);
if ($res === TRUE)
  // extract the unzip file to given path
  echo "Unzip Successful!";
  echo "Unzip unsuccessful!!! - Unable to open the file";



  Output :

  Unzip Successful!

About Me
Rahul Yadav

Rahul Yadav

Technical Architect

Kuala Lumpur, Malaysia

Connect Me:     

I'm a Full Stack Web Developer working in a MNC and passionate of developing modern web and mobile applications.

I have designed and developed CodephpOnline & CodephpOnline Wiki platform to expatiate my coding and technology learning experiences.

In my leisure time, I write technical articles on web development such as PHP, Laravel, CodeIgniter, Mediawiki, Linux, Angular, Ionic, ReactJS, NodeJS, AJAX, jQuery, Cloud and more.

Tag Cloud