PHP ob_get_length() Function

P
PHP ob_get_flush() Function
PHP ob_get_level() Function

In this article, you will learn how to get the length of the content in the output buffer (topmost buffer). The ob_get_length() function in PHP returns the length of the topmost output buffer’s contents in bytes. This is not always the same as the number of characters because some characters may have more than one byte.

what is the syntax of the OB_GET_LENGTH() function in php?

examples of the OB_GET_LENGTH() function

Example 1. In this example, we display the number of characters in the output buffer.

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

echo "The contents of the buffer are $length characters long";
?>
PHP ob_get_flush() Function
PHP ob_get_level() Function

Add comment

Tutor Network

Share this

Learn PHP from A to Z