Examples
ZipArchive::addEmptyDir
Zip
PHP Manual

# The ZipArchive class

## Introduction

A file archive, compressed with Zip.

## Class synopsis

ZipArchive
ZipArchive {
/* Properties */
/* Methods */
bool addEmptyDir ( string `$dirname` )
bool addFile ( string `$filename` [, string `$localname` ] )
bool addFromString ( string `$localname` , string `$contents` )
bool close ( void )
bool deleteIndex ( int `$index` )
bool deleteName ( string `$name` )
bool extractTo ( string `$destination` [, mixed `$entries` ] )
string getArchiveComment ( void )
string getCommentIndex ( int `$index` [, int `$flags` ] )
string getCommentName ( string `$name` [, int `$flags` ] )
mixed getFromIndex ( int `$index` [, int `$flags` ] )
mixed getFromName ( string `$name` [, int `$flags` ] )
string getNameIndex ( int `$index` )
string getStatusString ( void )
resource getStream ( string `$name` )
mixed locateName ( string `$name` [, int `$flags` ] )
mixed open ( string `$filename` [, int `$flags` ] )
bool renameIndex ( int `$index` , string `$newname` )
bool renameName ( string `$name` , string `$newname` )
mixed setArchiveComment ( string `$comment` )
mixed setCommentIndex ( int `$index` , string `$comment` )
mixed setCommentName ( string `$name` , string `$comment` )
mixed statIndex ( int `$index` [, int `$flags` ] )
mixed statName ( name `$name` [, int `$flags` ] )
mixed unchangeAll ( void )
mixed unchangeArchive ( void )
mixed unchangeIndex ( int `$index` )
mixed unchangeName ( string `$name` )
}

## Properties

status

  Status of the Zip Archive

statusSys

  System status of the Zip Archive

numFiles

  Number of files in archive

filename

  File name in the file system

comment

  Comment for the archive

## Table of Contents

- ZipArchive::addEmptyDir — Add a new directory
- ZipArchive::addFile — Adds a file to a ZIP archive from the given path
- ZipArchive::addFromString — Add a file to a ZIP archive using its contents
- ZipArchive::close — Close the active archive (opened or newly created)
- ZipArchive::deleteIndex — delete an entry in the archive using its index
- ZipArchive::deleteName — delete an entry in the archive using its name
- ZipArchive::extractTo — Extract the archive contents
- ZipArchive::getArchiveComment — Returns the Zip archive comment
- ZipArchive::getCommentIndex — Returns the comment of an entry using the entry index
- ZipArchive::getCommentName — Returns the comment of an entry using the entry name
- ZipArchive::getFromIndex — Returns the entry contents using its index.
- ZipArchive::getFromName — Returns the entry contents using its name.
- ZipArchive::getNameIndex — Returns the name of an entry using its index
- ZipArchive::GetStatusString — Returns the status error message, system and/or zip messages.
- ZipArchive::getStream — Get a file handler to the entry defined by its name (read only).
- ZipArchive::locateName — Returns the index of the entry in the archive
- ZipArchive::open — Open a ZIP file archive
- ZipArchive::renameIndex — Renames an entry defined by its index
- ZipArchive::renameName — Renames an entry defined by its name
- ZipArchive::setArchiveComment — Set the comment of a ZIP archive
- ZipArchive::setCommentIndex — Set the comment of an entry defined by its index
- ZipArchive::setCommentName — Set the comment of an entry defined by its name
- ZipArchive::statIndex — Get the details of an entry defined by its index.
- ZipArchive::statName — Get the details of an entry defined by its name.
- ZipArchive::unchangeAll — Undo all changes done in the archive.
- ZipArchive::unchangeArchive — Revert all global changes done in the archive.
- ZipArchive::unchangeIndex — Revert all changes done to an entry at the given index.
- ZipArchive::unchangeName — Revert all changes done to an entry with the given name.

Examples
ZipArchive::addEmptyDir
Zip
PHP Manual