Kelių failų archyvavimas naudojant PHP ir gzip
PHP programinio kodo pavyzdys:
<?php //sample array of filenames $fileNamesArray["file1"]; $fileNamesArray["file2"]; $fileNamesArray["file3"]; //count the number of items in the array $num = count($fileNamesArray); //filename of compressed file (in same directory) $file = "compressedfile.txt.gz"; //open gz -- 'w9' is highest compression $fp = gzopen ($filename, 'w9'); //loop through array and write each line into the compressed file for (i = 0; i <= $num; i ++) { gzwrite ($fp, "$fileNamesArray[i]\n"); } //close the file gzclose ($fp); ?>