note 85823 added to function.ob-start
| From: | codextasy at gmail dot com | Date: | Fri, 19 Sep 2008 08:26:42 +0000 |
| Subject: | note 85823 added to function.ob-start | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-144537@lists.php.net to get a copy of this message | ||
There is a difference between the documentation and real callback functions invocation.
Manual says: "The function will be called when ob_end_flush() is called, or when the output
buffer is flushed to the browser at the end of the request."
Actually, the callback function, once set by ob_start(), will be called regardless.
Here are the functions that invoke callback function immediately:
ob_clean
ob_end_clean
ob_end_flush
ob_flush
ob_get_clean
BUT only two of them return the result returned by the callback (ob_end_flush, ob_flush), other
functions discard it.
At the end of the request, even if none of the functions listed above is called, the callback will
be called anyway, and its result will be returned to the browser (well, at least this is
corresponding to the manual).
There is one more trick:
If you set callback function with chunk_size > 1, callback function will be called each time
output buffer is equal or exceeds chunk_size and its result will be output to the browser, even if
you call any of ob_clean(), ob_end_clean(), ob_get_clean() later, so be aware of this fact.
----
Server IP: 91.189.86.54
Probable Submitter: 89.222.212.81 (proxied: 89.222.212.81)
----
Manual Page -- http://www.php.net/manual/en/function.ob-start.php
Edit -- https://master.php.net/note/edit/85823
Del: integrated -- https://master.php.net/note/delete/85823/integrated
Del: useless -- https://master.php.net/note/delete/85823/useless
Del: bad code -- https://master.php.net/note/delete/85823/bad+code
Del: spam -- https://master.php.net/note/delete/85823/spam
Del: non-english -- https://master.php.net/note/delete/85823/non-english
Del: in docs -- https://master.php.net/note/delete/85823/in+docs
Del: other reasons-- https://master.php.net/note/delete/85823
Reject -- https://master.php.net/note/reject/85823
Search -- https://master.php.net/manage/user-notes.php