ob_start
Turn on output buffering.
ob_start Function synopsis
ob_start(
$callback = null,
int $chunk_size = 0,
int $flags = PHP_OUTPUT_HANDLER_STDFLAGS
): bool
Parameters
$callback
OptionalDefault valuenull
An optional $callback callable may be
specified. It can also be bypassed by passing null.
$chunk_size
OptionalTypeintDefault value0
If the optional parameter $chunk_size is passed,
the buffer will be flushed after any block of code resulting in output
that causes the buffer's length to equal
or exceed $chunk_size.
The default value 0 means
that all output is buffered until the buffer is turned off.
See for more details.
$flags
OptionalTypeintDefault valuePHP_OUTPUT_HANDLER_STDFLAGS
The $flags parameter is a bitmask that controls
the operations that can be performed on the output buffer. The default
is to allow output buffers to be cleaned, flushed and removed, which
can be set explicitly via the
buffer control flags
.
See
for more details.
$flags accepts one or a bitmask of the following constant values:
PHP_OUTPUT_HANDLER_CLEANABLEPHP_OUTPUT_HANDLER_FLUSHABLEPHP_OUTPUT_HANDLER_REMOVABLEPHP_OUTPUT_HANDLER_STDFLAGS
Return value
Typebool
Returns true on success, false on failure
Changes to the ob_start Function
PHP 8.0
- Return type added:
bool - Parameter name of parameter #1 changed:
$user_functionto$callback - Parameter default value added for position #1 (
$callback):null - Parameter type added for parameter #2 (
$chunk_size):int - Parameter default value added for position #2 (
$chunk_size):0 - Parameter type added for parameter #3 (
$flags):int - Parameter default value added for position #3 (
$flags):PHP_OUTPUT_HANDLER_STDFLAGS
ob_start(
- $user_function,
+ $callback = null,
- $chunk_size,
+ int $chunk_size = 0,
- $flags
+ int $flags = PHP_OUTPUT_HANDLER_STDFLAGS
- )
+ ): bool ob_start Function Availability
ob_start Function Availability| PHP Version | Availability |
|---|---|
| PHP 8.6Future Release | Yes |
| PHP 8.5Upcoming Release | Yes |
| PHP 8.4Supported (Latest) | Yes |
| PHP 8.3Supported | Yes |
| PHP 8.2Security-Fixes Only | Yes |
| PHP 8.1Security-Fixes Only | Yes |
| PHP 8.0Unsupported | Yes |
| PHP 7.4Unsupported | Yes |
| PHP 7.3Unsupported | Yes |
| PHP 7.2Unsupported | Yes |
| PHP 7.1Unsupported | Yes |
| PHP 7.0Unsupported | Yes |
| PHP 5.6Unsupported | Yes |
| PHP 5.5Unsupported | Yes |
| PHP 5.4Unsupported | Yes |
| PHP 5.3Unsupported | Yes |