zip_entry_close() function in PHP


The zip_entry_close() function is used to close a zip archive opened by the zip_entry_open() function.

Syntax

zip_entry_close(zip_entry)

Parameters

  • zip_entry − The zip entry resource. Required.

Return

The zip_entry_close() function Returns TRUE on success and FALSE on failure.

The following is an example. Let’s say we have "new.zip" file as our archive.

Example

<?php
   $zip = zip_open("new.zip");
   $zip_entry = zip_read($zip);
   zip_entry_open($zip, $zip_entry, "rb");
   $myfile = zip_entry_name($zip_entry);
   $res = zip_entry_close($zip_entry);
   if ($res == true)
      echo("$myfile closed! ");
   else
      echo("$myfile cannot be closed!");
   zip_close($zip);
?>

Updated on: 26-Jun-2020

31 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements