Hi all
I think I have a handle on basic OOP and classes and believe that one or two of my methods would benefit from a try catch block, or to put it another way I would like to extend my knowledge and give myself a nice pat on the back as it is getting very lonely here with only PHP builder for company.... must get out more!
Anyway, I have the following method (which is open to comment)
public function createResponseFile($response) {
$xml_File = $this->file_name;
if (@$fh = fopen($xml_File, 'a')) {
fwrite($fh, $this->xml_dtd . $response);
fclose($fh);
self::adminEmail('ok');
} else {
self::adminEmail('error');
}
}
Although the I'm sure functionality would be the same, I have tried to get a try catch block in place of the if else but cannot get the same outcome and hoped that someone would be able to point me in the right direction as in do I need to throw an expception within the if esle and catch this?
Many thanks