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

ob_get_flush

Description

The ob_get_flush of Output Control for PHP flush the output buffer, return it as a string and turn off output buffering.

Syntax

ob_get_flush(): string|false

Return

Returns the output buffer or false if no buffering is active.

Examples

1 · return

<?

ob_start();

    echo "output";
    $return = ob_get_flush();

    echo PHP_EOL . "return: $return";
output
return: output

2 · output · ob_end_clean

<?

ob_start();

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

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

ob_end_clean();

echo PHP_EOL . "return1: $return1" . PHP_EOL . "return2: $return2";
output1output2
return1: output1
return2: output1output2

3 · output · ob_end_flush

<?

ob_start();

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

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

ob_end_flush();

echo PHP_EOL . "return1: $return1" . PHP_EOL . "return2: $return2";
output1output2
return1: output1
return2: output1output2