Current Location: Home> Function Categories> ob_get_length

ob_get_length

Returns the length of the output buffer
Name:ob_get_length
Category:Output buffer control
Programming Language:php
One-line Description:Returns the number of bytes of data in the top-most output buffer.

Definition and usage

ob_get_length() function returns the length (in bytes) of the top-most output buffer content. This is not always the same as the number of characters, as some characters may take up more than one byte.

Example

Displays the number of characters in the output buffer:

 <?php
ob_start ( ) ;
echo "Hello World!" ;
$length = ob_get_length ( ) ;
ob_end_clean ( ) ;

echo "The content of the buffer is $length bytes long" ;
?>

Try it yourself

grammar

 ob_get_length ( ) ;
Similar Functions
Popular Articles