zip_entry_open() function in PHP


The zip_entry_open() function is used to open a zip archive entry for reading.

Syntax

zip_entry_open(zip_file,zip_entry,mode)

Parameters

  • zip_file − The zip file to be read

  • zip_entry − The zip entry to open.

  • mode − The type of access needed for zip archive

Return

The zip_entry_open() function Returns TRUE on success, or FALSE on failure.

Example

<?php
   $zip_file = zip_open("new.zip");
   $zip_entry = zip_read($zip_file);
   zip_entry_open($zip_file, $zip_entry, "rb");
   $myfile = zip_entry_name($zip_entry);
   if($myfile == true)
   echo("Zip file: " . $file . " is opened now!<br>");
   $flag = zip_entry_close($zip_entry);
   if ($flag == true)
   echo("$file . " closed!");
   zip_close($zip_file);
?>

Output

new/one is opened now!
new/one closed!

Updated on: 26-Jun-2020

42 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements