This is a little trick to compress PHP files when transmitted from web server into web browser using standard PHP functions. This method will save bandwidth and increase your web speed.
First method, using zlib extension.
You can only do this if your web server support zlib extention.
Second method, using ob_start() function. Call ob_start() function with ob_gzhandler will compress the output. Just call this function on the top of every script you have.
<?php
ob_start('ob_gzhandler');
/* put any code below */
?>
If you're curious, try it using Firebug and you will see how amazing this trick is.
Jason Hopkins wrote :1820
Please note that this code does not, in any way reduce the
file size of your PHP/HTML files. Instead, it compresses
the code sent to the browser using less bandwidth.