$zip = new ZipArchive(); if ($zip->open('archive.zip') === TRUE) { $fileInfo = $zip->statName('example.txt'); echo 'Name: '.$fileInfo['name'].'In this example, we create a new `ZipArchive` object and open an existing zip archive called "archive.zip". We then use the `statName()` function with the filename "example.txt" to retrieve information about that file. Finally, we display the retrieved information. The package library for this function is the PHP ZipArchive extension.
'; echo 'Actual size: '.$fileInfo['size'].' bytes
'; echo 'Compressed size: '.$fileInfo['comp_size'].' bytes
'; echo 'Last modified time: '.date('Y-m-d H:i:s', $fileInfo['mtime']).'
'; echo 'CRC checksum: '.$fileInfo['crc'].'
'; echo 'Compression method: '.$fileInfo['comp_method'].'
'; $zip->close(); } else { echo 'Failed to open archive.zip'; }