Example 1 — Register ob_gzhandler With ob_start
Start a buffer using ob_gzhandler as the callback, list the handler name, then end-clean.
<?php
$ok = ob_start('ob_gzhandler');
$handlers = ob_list_handlers();
ob_end_clean();
echo $ok ? "started" : "failed", PHP_EOL;
echo $handlers[0], PHP_EOL; How It Works
- ob_start('ob_gzhandler') turns buffering on with that callback.
- ob_list_handlers() reports the active handler name.
- ob_end_clean() discards and ends the buffer for a quiet demo.
- The printed lines confirm the handler was registered.

