zip_open() function in PHP


The zip_open() function opens a zip file for reading. It returns an open zip file on success and FALSE on failure.

Syntax

zip_open(zip_file)

Parameters

  • zip_file − The path of the file to be opened.

Return

The zip_open() function returns an open zip file on success and FALSE on failure.

Example

<?php
   $zip = zip_open("new.zip");
   if ($zip) {
      while ($zip_entry = zip_read($zip)){
         echo "Compressed = ". zip_entry_compressedsize($zip_entry). "<br/>";
      }
      zip_close($zip);
   }
?>

Output

Compressed: 90
Compressed: 12
Compressed: 67

Samual Sam
Samual Sam

Learning faster. Every day.

Updated on: 26-Jun-2020

32 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements