HomeMenu
Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

ob_get_length

Description

The ob_get_length of Output Control for PHP return the length of the output buffer.

Syntax

ob_get_length(): int|false

Return

Returns the length of the output buffer contents, in bytes, or false if no buffering is active.

Examples

1 · return

<?

ob_start();

    $return = ob_get_length();

    echo $return;
0

2 · output

<?

ob_start();

    echo "output1";
    $return1 = ob_get_length();

    echo "output2";
    $return2 = ob_get_length();

ob_end_clean();

echo $return1 . PHP_EOL . $return2;
7
14