ob_start(); 在PHP?

When using on_start() does it make any difference to do,

// ENABLE GZIP COMPRESSION
ob_start();
ob_start('ob_gzhandler');

Or is this exactly the same,

// ENABLE GZIP COMPRESSION
ob_start('ob_gzhandler');

I ask as with the first example my website seems to speed up a bit.

Thanks

You should do either:

ob_start();

or:

ob_start('ob_gzhandler');

But not both. You can check $_SERVER['HTTP_ACCEPT_ENCODING'] to see if the user agent accepts gzip encodings:

if(strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false)
   ob_start('ob_gzhandler');
else
    ob_start();

The first starts two layers of output buffering. Waste of memory.

No difference at all. ob_start() is stackable. Which means the second ob_start() will simply append it's contents to the first ob_start() when flushed.