- ob_start: documentation ( source)
- register_shutdown_function: documentation ( source)
<?php
class foo {
function __construct() {
register_shutdown_function( array( $this, '__destruct' ) );
}
function bar() {
}
function __destruct() {
return true;
}
}
$GLOBALS['fb'] = new foo;
function foo_bar( $buffer ) {
$buffer .= "gettype( 'fb' ): " . gettype( $GLOBALS['fb'] );
return $buffer;
}
ob_start( 'foo_bar' );