August 2003
Intermediate to advanced
1104 pages
19h 27m
English
These functions compress and decompress strings using the bzip2 or gzip libraries. There are functions described in Chapter 9 for reading and writing to compressed files.
Use bzcompress (Listing 12.60) to compress a string using the bzip2 library. The optional blocksize argument may be set with an integer from 1 to 9, with 9 being the highest compression. By default, blocksize is 4. The optional workfactor argument influences how bzcompress handles long strings of repetitive sequences. It should be an integer from 0 to 250.
<?php $text = "Core PHP Programming"; $bzText = bzcompress($text, 9); print(bin2hex($bzText) ... |
Read now
Unlock full access