Skip to content

Instantly share code, notes, and snippets.

@nacin
Created March 1, 2012 15:49
Show Gist options
  • Save nacin/1950630 to your computer and use it in GitHub Desktop.
Save nacin/1950630 to your computer and use it in GitHub Desktop.
Example insanity pt 2
<?php
register_shutdown_function( 'ob_end_flush' );
class foo {
function __construct() {
register_shutdown_function( array( &$this, '__destruct' ) );
}
function bar( $buffer ) {
return $buffer;
}
function __destruct() {
return true;
}
}
$GLOBALS['fb'] = new foo;
function foo_bar($buffer) {
$GLOBALS['fb']->bar( $buffer );
return $buffer;
}
ob_start('foo_bar');
echo "This works.";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment