ob_list_handlers
Description
The ob_list_handlers of Output Control for PHP list all output handlers in use.
Syntax
ob_list_handlers(): array
Return
Returns an array with the output handlers in use (if any).
If output_buffering is enabled and no output_handler is set, or no callback or null was passed to ob_start(), "default output handler" is returned. Enabling output_buffering and setting an output_handler is equivalent to passing an internal (built-in) function to ob_start().
If a callable was passed to ob_start(), the fully qualified name of the callable is returned. If the callable is an object implementing __invoke(), the fully qualified name of the object's __invoke() method is returned. If the callable is a Closure, "Closure::__invoke" is returned.
Examples
1 · output_buffering
<? $return = ob_list_handlers(); print_r($return);
Array ( [0] => default output handler )
2 · ob_start
<? ob_start(); $return = ob_list_handlers(); print_r($return);
Array ( [0] => default output handler [1] => default output handler )
3 · gzip
<? $callback = "ob_gzhandler"; ob_start($callback); $return = ob_list_handlers(); print_r($return);
Array ( [0] => default output handler [1] => ob_gzhandler )
4 · anonymous
<? $callback = function($string) { return $string; }; ob_start($callback); $return = ob_list_handlers(); print_r($return);
Array ( [0] => default output handler [1] => Closure::__invoke )
5 · rewrite
<? $name = "name"; $value = "value"; output_add_rewrite_var($name, $value); $return = ob_list_handlers(); print_r($return);
Array ( [0] => default output handler [1] => URL-Rewriter )