The zip_entry_open() function is an inbuilt function in PHP which is used to open a zip entry archive for reading. Opening a file or a directory in a zip archive with the zip_entry_open function creates a new stream and establishes a connection between the stream and a file or a directory in a Zip Archive. The zip resource and the zip entry resource to be opened and sent as parameters to the zip_entry_open() function and it returns True on success and False on failure.
bool zip_entry_open( $zip, $zip_entry, $mode )
Parameters: This function accepts three parameters as mentioned above and described below:
- $zip: It is a mandatory parameter which specifies the zip resource to be read.
- $zip_entry: It is a mandatory parameter which specifies the zip entry resource.
- $mode: It is an optional parameter which the access type of the required for the zip archive.
Return Value: It returns True on success or False on failure.
Errors And Exceptions:
- The zip_entry_open() function returns an ER_OPEN error if the zip archive is invalid.
- The zip_entry_open() function returns an ER_NOZIP error if the zip archive is empty.
Below programs illustrate the zip_entry_open() function in PHP:
Suppose a zip file articles.zip contains the following file:
Zip file: articles/geeks open successfully Zip file: articles/geeks closed successfully
Suppose a zip file articles.zip contains the following files:
Zip file: articles/geeks open successfully Zip file: articles/geeks closed successfully Zip file: articles/geeks1 open successfully Zip file: articles/geeks1 closed successfully
- PHP | zip_entry_close() Function
- PHP | zip_entry_compressedsize() Function
- PHP | zip_entry_name() Function
- PHP | zip_entry_filesize() Function
- How to get the function name inside a function in PHP ?
- PHP | pos() Function
- PHP | key() Function
- D3.js | d3.map.set() Function
- PHP | Ds\Set add() Function
- PHP | end() Function
- p5.js | log() function
- p5.js | sin() function
- p5.js | cos() function
- PHP | Ds\Map xor() Function
- PHP | abs() Function
- p5.js | max() function
- D3.js | d3.hcl() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.