Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can PHP's ob_start be called more then once?

Tags:

php

Can PHP's ob_start be called more then once?

Sorry if this is a dumb question but I really don't know.

My site is really large (file quantity), its a social network and one of the included files uses ob_start PHP's output buffer for something, i'm not ure someone else started my site a long time ago and now it is mine I need to look into it more to see what it's doing exactly.

Anyways I am wanting to use ob_start ("ob_gzhandler"); to compress CSS files and all files on my site get loaded (included) through the index file so I am wanting to know if I am able to use that even though it is already in use somewhere else in the code?

like image 779
JasonDavis Avatar asked Jul 29 '09 04:07

JasonDavis


1 Answers

Yes, you can call it more than once. It creates a new buffer each time however, so be careful.

From the manual: "Output buffers are stackable, that is, you may call ob_start() while another ob_start() is active. Just make sure that you call ob_end_flush() the appropriate number of times. If multiple output callback functions are active, output is being filtered sequentially through each of them in nesting order."

like image 84
zombat Avatar answered Sep 30 '22 03:09

zombat