PHP Function bzwrite for BZIP2 Compression
PHP bzwrite is a function that can write a string into a given bzip2 file stream. This is similar to the functions fopen(), fwrite() and fclose() in PHP, but designed specifically for use with Bzip2 compression.
The bzip2 module provides functions that transparently read and write BZip2 (.bz2) compressed files. This is done without the need to change PHP source code or use any external libraries.
These functions are based on the bzip2 library by Julian Seward. They are provided as a standard extension to PHP and can be enabled with the --with-bz2[=DIR] configuration option when compiling PHP.
bzopen() opens a bzip2 (.bz2) file for reading or writing. The file name or an existing stream resource may be opened, and the modes 'r' (read), and 'w' (write) are supported. Anything else will cause bzopen() to return false. bzopen() returns a pointer to the newly opened file.
stdout() writes a string to the bzip2 file stream pointed at by src, or stdin, if src is not specified. Its reading stops when length (uncompressed) bytes have been read or EOF is reached, whichever happens first. It returns the number of bytes written, or False if error occurs.
stdin() reads a bzip2 file from the standard input stream, or stdin, if no src is specified. Its writing stops when length (uncompressed) bytes are read or EOF is reached, unless ob_flush() has been called before, in which case it continues to write until the end of the file.