open($zipname, ZIPARCHIVE::CREATE) !== TRUE) { die ("Could not open archive"); } // list of files to add // list of files to add $fileList = array( 'fstab2.php', 'images/branch.gif', 'files/php1.php' ); // add files foreach ($fileList as $f) { $zip->addFile($f) or die ("ERROR: Could not add file: $f"); } // close and save archive $zip->close(); echo "Archive created successfully."; ?>