ob_start() clarification

+1 Yannis Sp · August 26, 2014
I understand that ob_start() is used to remember everything that is above it but doesn't let anything to be displayed.My confusion is when in Bucky's series(he or Alex i don't remember) said that we have to use it before we make a SESSION_START().First why is that and second someone explain me the main concept or ob_start() function.Thank you :D

Post a Reply


Oldest  Newest  Rating
+3 Samuel Oloruntoba · August 28, 2014
ob_start is used whenever you want all headers to be set before the content is sent to the output buffer(screen), this usually makes the webpage a little bit faster as headers are first processed and then the contents are processed.
0 Yannis Sp · August 28, 2014
Thanks a lot mate!
Btw why should headers be set first?Are they bigger than normal content?
+3 Samuel Oloruntoba · August 28, 2014
the browser does little or no processing for text data being outputted, but cookies and sessions and all data passed through the headers need more processing, normally the browser would process both of them asynchronously which would sometimes cause slower page load times, but with ob_start enabled the browser would first process the header information before processing the text content. html processing does not affect this process because the browser does that in real time.
0 Yannis Sp · August 28, 2014
Wait isn't html a piece of information that the server sends via headers?I got a little confused on the last sentence.
+4 Samuel Oloruntoba · August 28, 2014
when the browser is combining css and html for display, that happens in real time, but the printing of the code is handled by the server
0 Yannis Sp · August 28, 2014
I see!Now everything is clear.
Thanks bro for the help :)
0 Samuel Oloruntoba · August 28, 2014
no problem
  • 1



Server-side, HTML embedded scripting language used to create dynamic Web pages.