src/Zip.php
public function contents()
    {
        if ($this->closed || !$this->file) {
            throw new ArchiveIOException('Can not read from a closed archive');
        }

        $result = array();

        $centd = $this->readCentralDir();

        @rewind($this->fh);
        @fseek($this->fh, $centd['offset']);

        for ($i = 0; $i < $centd['entries']; $i++) {
            $result[] = $this->header2fileinfo($this->readCentralFileHeader());
        }

        $this->close();
        return $result;
    }
public function contents()
    {
        if ($this->closed || !$this->file) {
            throw new ArchiveIOException('Can not read from a closed archive');
        }

        $result = array();

        $centd = $this->readCentralDir();

        @rewind($this->fh);
        @fseek($this->fh, $centd['offset']);

        for ($i = 0; $i < $centd['entries']; $i++) {
            $result[] = $this->header2fileinfo($this->readCentralFileHeader());
        }

        $this->close();
        return $result;
    }
public function contents ( ) { if ( $ this -> closed || ! $ this -> file ) { throw new ArchiveIOException ( 'Can not read from a closed archive' ) ; } $ result = array ( ) ; $ centd = $ this -> readCentralDir ( ) ; @ rewind ( $ this -> fh ) ; @ fseek ( $ this -> fh , $ centd [ 'offset' ] ) ; for ( $ i = 0 ; $ i < $ centd [ 'entries' ] ; $ i ++ ) { $ result [ ] = $ this -> header2fileinfo ( $ this -> readCentralFileHeader ( ) ) ; } $ this -> close ( ) ; return $ result ; }
Read the contents of a ZIP archive

This function lists the files stored in the archive, and returns an indexed array of FileInfo objects

The archive is closed afer reading the contents, for API compatibility with TAR files
Reopen the file with open() again if you want to do additional operations

@throws ArchiveIOException
@return FileInfo[]
Read the contents of a ZIP archive