function callback($buffer)
{
if(strpos($buffer,'Maximum execution')!==false){
$buffer= 'Time out';
}
return $buffer;
}
ob_start("callback");
?>
It's like comparing apples to oranges.
set_time_limit(1);
sleep(2);
ob_end_flush();
?>