PHP: ob_get_status - Manual (original) (raw)

(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)

ob_get_status — Get status of output buffers

Description

Parameters

full_status

[true](reserved.constants.php#constant.true) to return all active output buffer levels. If [false](reserved.constants.php#constant.false) or not set, only the top level output buffer is returned.

Return Values

If full_status is omitted or [false](reserved.constants.php#constant.false) a simple array holding status information on the active output level is returned.

If full_status is [true](reserved.constants.php#constant.true) an array with one element for each active output buffer level is returned. The output level is used as key of the top level array and each array element itself is another array holding status information on one active output level.

An empty array is returned if output buffering is not turned on.

**ob_get_status() return array elements

Key Value
name Name of active output handler (see the return values ofob_list_handlers() for details)
type 0 (internal handler) or1 (user supplied handler)
flags Bitmask of flags set by ob_start(), the type of output handler (see above) and the status of the buffering process ( PHP_OUTPUT_HANDLER_* constants). If the handler successfully processed the buffer and did not return false,PHP_OUTPUT_HANDLER_STARTED and**PHP_OUTPUT_HANDLER_PROCESSED** will be set. If the handler failed while processing the buffer or returned false,PHP_OUTPUT_HANDLER_STARTED and**PHP_OUTPUT_HANDLER_DISABLED** will be set.
level Output nesting level (zero based). Note that the value returned for the same level by ob_get_level() is off by one. The first level is 0 for ob_get_status(), and 1 for ob_get_level().
chunk_size Chunk size in bytes. Set by ob_start() or output_buffering is enabled and its value is set to a positive integer
buffer_size Output buffer size in bytes
buffer_used Size of data in output buffer in bytes (the same as the integer return value of ob_get_length())

Examples

Example #1 Array returned when full_status is [false](reserved.constants.php#constant.false)

Array ( [name] => URL-Rewriter [type] => 0 [flags] => 112 [level] => 2 [chunk_size] => 0 [buffer_size] => 16384 [buffer_used] => 1024 )

Example #2 Array returned when full_status is [true](reserved.constants.php#constant.true)

Array ( [0] => Array ( [name] => default output handler [type] => 0 [flags] => 112 [level] => 1 [chunk_size] => 0 [buffer_size] => 16384 [buffer_used] => 2048 )

[1] => Array
    (
        [name] => URL-Rewriter
        [type] => 0
        [flags] => 112
        [level] => 2
        [chunk_size] => 0
        [buffer_size] => 16384
        [buffer_used] => 1024
    )

)

See Also

Found A Problem?

rmagalhaess at hotmail dot com

8 years ago

The fields inside the array returned by ob_get_status() are:

Array
(
    [name] => default output handler
    [type] => 0
    [flags] => 112
    [level] => 1
    [chunk_size] => 0
    [buffer_size] => 16384
    [buffer_used] => 0
)

These values are filled just after the function ob_start()