[go: nahoru, domu]

Voting

: max(four, eight)?
(Example: nine)

The Note You're Voting On

damian at thebestisp dot dot dot com
8 years ago
It seems like some people are using this to workaround output buffering instead of simply turning it off. To me, if you have an output buffer, it's there for a reason, otherwise you would either do stuff and use ob_flush() or ob_end_flush(), do stuff, and maybe ob_start() again.
Here's how to properly end all output buffers without having to suppress errors (due to there not being any buffers). If you do want a single level of output buffering, I've included a piece for that as well.
<?php
#Get rid of output buffer entirely
while (ob_get_level()) {ob_end_flush();}

#Make sure we have 1 level of output buffering if this isn't CLI.
$notcli=(int)(PHP_SAPI!=='cli');
while ((
$diff=ob_get_level()-$notcli)!==0) {
if (
$diff>0) {ob_end_flush();}
else {
ob_start();}
}

<< Back to user notes page

To Top