How to create a zip archive using PHP
TAGS: PHP, ZIP, Archive

if (isset($_POST['dozip']))  { 
$thedir = getcwd(); 
$zippath = $thedir . "/" . "";	 

$zip = new ZipArchive(); 
if ($zip->open($zippath, ZipArchive::CREATE)) {	 

echo "Finished"; exit(); 

<TD>Click here to create ZIP archive: </TD> 
<TD><INPUT TYPE='submit' NAME='dozip' VALUE='Create zip archive'></TD> 

This snippet shows how easy it is to create a .zip archive using PHP. Remember to have the three text files present in your directory.