Zlib Compression Functions in PHP

Zlib Compression Functions in PHP

Zlib Compression Functions in PHP
=========================
 This ZLib Compression contains most of the filesystem functions which work with gzip-compressed files (and uncompressed files, too, but not with sockets).

Note: Version 4.0.4 introduces a fopen-wrapper for .gz-files, so that you can use a special ‘zlib:’ URL to access compressed files transparently using the normal f*()

file access functions if you prepend the filename or path with a ‘zlib:’ prefix when calling fopen().

This feature requires a C runtime library that provides the fopencookie() function. To my current knowledge the GNU libc is the only library that provides this feature.
Some Functions that handling the gz files are
     gzclose — Close an open gz-file pointer
     gzeof — Test for end-of-file on a gz-file pointer
     gzfile — Read entire gz-file into an array
     gzgetc — Get character from gz-file pointer
     gzgets — Get line from file pointer
     gzgetss — Get line from gz-file pointer and strip HTML tags
     gzopen — Open gz-file
     gzpassthru — Output all remaining data on a gz-file pointer
     gzputs — Write to a gz-file pointer
     gzread — Binary-safe gz-file read
     gzrewind — Rewind the position of a gz-file pointer
     gzseek — Seek on a gz-file pointer
     gztell — Tell gz-file pointer read/write position
     gzwrite — Binary-safe gz-file write
     readgzfile — Output a gz-file
     gzcompress — Compress a string
     gzuncompress — Uncompress a deflated string
     gzdeflate — Deflate a string
     gzinflate — Inflate a deflated string
     gzencode — Create a gzip compressed string
These functions syntax are simitar to the file functions, here instead of ‘f’ we use ‘gz’.

Leave a Reply


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.