PHP: Data Size of Output Buffering
Question by Guest | 2015-02-01 at 11:12
I am using output buffering in PHP to be able to get some data for further processing.
Up to now, I am using the functions ob_start(), ob_get_contents() and ob_end_clean() similar like this:
ob_start(); // create data $data = ob_get_contents(); ob_end_clean();
As you can see, I am storing the created data in the variable $data.
However, what is missing here, is some function to retrieve or determine the size of the created data/the current internal buffer. However, I need this information between ob_start() and ob_end_clean(). Is there any function for that in PHP?
Related Topics
PHP: Write Output of a Script into Variable
Tutorial | 0 Comments
PHP: Send Output of a Script by Mail
Tutorial | 0 Comments
Units: SI Prefixes for Powers of Ten
Info | 0 Comments
jQuery: Read and Change Data Attribute Value
Tutorial | 0 Comments
XLS and XLSX: Maximum Number of Columns and Rows
Info | 2 Comments
PHP: Current Date and Time
Tutorial | 0 Comments
Important Note
Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.
You are searching for the function ob_get_length().
I have extended your example a little bit:
Here, we are storing the data into $data and the data size into $size.
2015-02-02 at 15:37