It nice to have and +1 for this.
string ob_get_contents(int $option = 0)
--
Yasuo Ohgaki
Hartmut Holzgraefe wrote:
> Yasuo Ohgaki wrote:
>
>> Added ob_get_status() to get array of buffers and it's status. (DO
>> NOT document this function yet)
>> Fixed crash bug with ob_end_*() function. ob_end_*() will not delete
>> buffers that may not be deleted.
>> php_start_ob_buffer() and php_ob_set_internal_handler() takes
>> parameter for
>> if the buffer created may be deleted or not.
>> Added 3rd parameter "bool erase" to ob_start(). If FALSE, buffer
>> may not be
>> deleted until script finshes.
>> Changed ob_*() function that have void return type to bool. All
>> ob_*() functions return TRUE for success, FALSE for failure.
>
>
> from looking at the codebase here in our company i find that
> we have just two use cases for the ob_...() stuff:
>
> - calling ob_start("callback") only and have callback() do the
> all the work on script termination
>
> - or the following sequence:
>
> ob_start();
> /* some output */;
> $var = ob_get_contents();
> ob_clean();
>
> especially
>
> ob_start(); print_r($var); error_log(ob_get_contents());
> ob_end_clean();
>
> so i've been thinking about a combination of of ob_get_contents()
> and ob_end_clean() for a long time
>
> i have come up with several different naming/implementation variants
>
> - a new function
> - string ob_get_clean(void)
> or
> - string ob_end_get(void)
>
> - an optional boolean parameter to an existing function
> - string ob_get_contents(bool $clean = false)
> or
> - string ob_end_clean(bool $return_contents = false)
>
> - an optional int parameter to an existing functions
> and some predefined constants
>
> - string ob_get_contents(int $option = 0)
>
> with OB_NONE -> no operation (0)
>
> OB_CLEAN -> clean output buffer
>
> OB_FLUSH -> flush output buffer
>
> OB_END -> end output buffering (current level)
>
> OB_APPLY_CALLBACK -> apply callback registered with
> ob_start, if any, on returned buffer contents
>
>
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php