Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * @param \ZipArchive $archive
- *
- * @return array
- */
- function getFiles(ZipArchive $archive)
- {
- $output = [];
- for ($i = 0; $i < $archive->numFiles; ++$i) {
- $explode = explode('/', $archive->getNameIndex($i));
- $pop = array_pop($explode);
- $stat = $archive->statIndex($i);
- $stat['name'] = $pop;
- if (empty($explode)) {
- $output['/'][] = $stat;
- } elseif ('' != $pop) {
- $output[implode('/', $explode)][] = $stat;
- }
- }
- return $output;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement