- register_shutdown_function: documentation ( source)
<?php
class Test
{
public function register()
{
register_shutdown_function(function () {
// make sure "flush()" is called last when there are multiple shutdown functions
register_shutdown_function([$this, 'flush'], true);
});
}
public function flush()
{
echo "flush";
}
}
$a = new Test;
$a->register();