That is what I got when I ran the following code:

echo gzcompress("abcdefg");

In the title I said “often useful”. If you look closely you’ll see why. The compressed version takes more bytes than the uncompressed. It’s not a surprise of course, the feature was created for compressing a file or something of considerable size, at least with a bigger size than 7 bytes (though characters may or may not take up a byte each I suppose…).

echo strlen(gzcompress("A camel is an even-toed ungulate within the genus Camelus, bearing distinctive fatty deposits known as humps on its back. There are two species of camels: the dromedary or Arabian camel has a single hump, and the bactrian has two humps. Dromedaries are native to the dry desert areas of West Asia, and Bactrian camels are native to Central and East Asia. Both species are domesticated; they provide milk and meat, and are working animals. "));

There, we printed the compressed versions size. I measured 258 chars for compressed and 2439 for the uncompressed version. That’s not even a very large chunk of text, so clearly gzcompress() will give a good reduction in almost all situations. As for how to uncompress:

$gz_string = gzcompress($reg_string);
echo strlen($gz_string);
$un_reg_string = gzuncompress($gz_string);
echo strlen($un_reg_string);

So to sum it up you won’t have any problems as long as you use strings not arrays for example. Compressing and uncompressing them in very useful and it’s great the PHP makes it so easy. Be sure to check out PHP’s other compression capabilities too.