❮ PHP Output Control Functions
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";
?>
Try it Yourself »
The ob_get_length()
function 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.
ob_get_length();
Return Value: | Returns an integer indicating how many bytes are in the output buffer |
---|---|
PHP Version: | 4.0.2+ |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!