tags:

views:

81

answers:

2

Should I use ob_start() before session_start() or session_start() before ob_start()?

A: 

I'm not sure that it matters but I would say ob_start() first since it captures output.

daedalus0x1a4
+5  A: 

It really doesn't matter. session_start() will not output anything (except for an error if something goes wrong) so the output buffer will not be affected either way. My script runs session_start() first simply because it loads that file first (alphabetical order).

To me, this seems like saying 'should I define $a = 1 or $b = 2 first?' when in the end $c = $a + $b will always be the same.

animuson