$za = new ZipArchive(); $za->open($source); for( $i = 0; $i < $za->numFiles; $i++ ){ $stat = $za->statIndex( $i ); $items = array( basename( $stat['name'] ) . PHP_EOL ); foreach($items as $item) { echo $item; } }
This code will list all the files inside the zip archive, but I want to exclude the list of folders. If the item in the array is a folder, I want to exclude it from the array, but I still want to list the files inside the folder. Just don't show the folder name in the list.
Is there a way to determine if an element is a directory in my foreach loop (how?) Or do I need to run a search in the array and search for folders and then cancel it (how?)?
thanks for the help
source share