Location: PHPKode > scripts > phpRetrieve > phpRetrieve/zipIt.php
<?php

function zipIt($file){

        //assume file extension is 3 chars
        $newFile = substr($file,0,-3)."zip";
		
		$zip = new ZipArchive();
		
        if ($zip->open($newFile, ZIPARCHIVE::CREATE)!==TRUE) {
                return $file;
        }
        $zip->addFile($file,substr($file,7));
        $zip->close();
        if(file_exists($newFile)){
                unlink($file);
                return $newFile;
        }
        else {
                return $file;
        }

}

?>
Return current item: phpRetrieve