<?php

function writeToFile$file$content )
{
    if ( ( 
$f fopen$file"w" ) ) === false )
    {
        return 
PEAR::raiseError(
            
"File not writeable",
            
23,
            
PEAR_ERROR_RETURN,
            
$file
        
);
    }
    
// ...
}

if ( 
PEAR::isError(
    
$err writeToFile"/tmp/foo""99 klingons..." 
    ) )
{
    
// handle error...
}
?>


<?php

PEAR
::setErrorHandling(
    
PEAR_ERROR_CALLBACK,
    
"handleError"
);

function 
handleError$err )
{
    
// handle error...
}

writeToFile"/tmp/foo" );

?>