PHP gzip


To improve speed of your website it is a good practice to use PHP gzip. To use gzip in your web page include following snippet in your PHP file. This way you can easily include gzip compression on your web page.

//put this on very top of you page
if(extension_loaded('zlib')) { ob_start('ob_gzhandler'); $compressed = ''; }
else { ob_start(); $compressed = ' not '; }
//replace next line with your code
echo 'This content is ' . $compressed . 'compressed with PHP gzip.';
//put this in the end of your page