👻 Check our latest review to choose the best laptop for Machine Learning engineers and Deep learning tasks!
Syntax:string zip_entry_name ($zip_entry)Parameters:This function takes one parameter, $zip_entry, which is required. Used to specify the zip record resource.Return value:Returns the name of the zip archive record on success.Errors and exceptions:
- Zip_entry_name() returns the zip archive name only on success, otherwise returns a PHP warning.
- The zip_entry_name() function returns ER_OPEN if zip- the archive is invalid.
- The zip_entry_name() function returns an ER_NOZIP error if the zip archive is empty.
content.xlsx
// Open zip file
$zip_handle
= zip_open (
" C: /xampp/htdocs/article.zip "
);
// Read zip archive
$zip_entry
= zip_read (
$zip_handle
);
// Read zip archive name
$file
= zip_entry_name (
$zip_entry
);
echo
(
"File Name:"
.
$file
);
// Close the zip archive
zip_close (
$zip_handle
);
?>
Output:File Name: article / content.xlsx
Program 2: Suppose a zip file article.zip contains following files and directories:
Directory: img - engineerforengineer.png
- engineerforengineer1.png
content.xlsx
gfg.pdf
image.jpeg
// Open the zip file
$zip_handle
= zip_open (
"C: /xampp/htdocs/article.zip"
);
if
(
is_resource
(
$zip_handle
))
{
while
(
$zip_entry
= zip_read (
$zip_handle
))
{
$file
= zip_entry_name (
$zip_entry
);
// Check the file name of the zip archive entry
$file_name
= zip_entry_name (
$zip_entry
);
echo
(
"File Name:"
.
$file_name
.
" < br > "
);
}
// close the zip archive
zip_close (
$zip_handle
);
}
else
echo
(
"Zip archive cannot be read. "
);
?>
Output:File Name: article / content.xlsx File Name: article / gfg.pdf File Name: article / image.jpeg File Name: article / img / File Name: article / img / engineerforengineer.png File Name: article / img / engineerforengineer1.png
Related Articles: - PHP | Zip_read() function
- PHP | Zip_close() function
- PHP | Zip_entry_close() Function
- PHP | Zip_entry_compressedsize() function
Link: http://php.net/manual/en/function.zip-entry-name.php
👻 Read also: what is the best laptop for engineering students?
We hope this article has helped you to resolve the problem. Apart from PHP Zip_entry_name () function, check other code Python module-related topics.
Want to excel in Python? See our review of the best Python online courses 2023. If you are interested in Data Science, check also how to learn programming in R.
By the way, this material is also available in other languages:
- Italiano PHP Zip_entry_name () function
- Deutsch PHP Zip_entry_name () function
- Français PHP Zip_entry_name () function
- Español PHP Zip_entry_name () function
- Türk PHP Zip_entry_name () function
- Русский PHP Zip_entry_name () function
- Português PHP Zip_entry_name () function
- Polski PHP Zip_entry_name () function
- Nederlandse PHP Zip_entry_name () function
- 中文 PHP Zip_entry_name () function
- 한국어 PHP Zip_entry_name () function
- 日本語 PHP Zip_entry_name () function
- हिन्दी PHP Zip_entry_name () function
Walter Lehnman
Moscow | 2023-04-01
Maybe there are another answers? What PHP Zip_entry_name () function exactly means?. Will use it in my bachelor thesis
Marie Sikorski
Boston | 2023-04-01
UI PHP module is always a bit confusing 😭 PHP Zip_entry_name () function is not the only problem I encountered. Will get back tomorrow with feedback
Frank OConnell
Boston | 2023-04-01
I was preparing for my coding interview, thanks for clarifying this - PHP Zip_entry_name () function in Python is not the simplest one. Will use it in my bachelor thesis