if(ob_get_level() > 0){
//there are some buffers active.
}
$ php -d output_buffering=1 -r'var_dump(ob_get_level());'
int(1)
$ php -d output_buffering=0 -r'var_dump(ob_get_level());'
int(0)
It does however check whether there is an output buffer active, not what the actual setting of PHP itself is. A manual ob_start()
(or more then one) will also increase the level. Usually this is more interesting then the actual output_buffering
setting. If you actually need that, fo with the ini_get
answer.