note 94908 added to function.set-error-handler

From: Date: Wed, 02 Dec 2009 10:36:35 +0000
Subject: note 94908 added to function.set-error-handler
Groups: php.notes 
Request: Send a blank email to php-notes+get-163479@lists.php.net to get a copy of this message
I have the following code: <?php function calc() { try { $a=1; $b=2; $result=$a*$b$c; if (!$result) { throw new Exception('Wrong Formula'); }else return $result; } catch (Exception $e) { echo 'Caught exception: ', $e->getMessage() ; } } $calling=calc(); echo "<br>CALL : ".$calling; ?> Here I have written $result=$a*$b$c; which send a parser error, I want to know how to handle this error programatically, so that I can send proper message to user. I have also tried exception handling but its not working ---- Server IP: 69.147.83.197 Probable Submitter: 125.99.156.242 ---- Manual Page -- http://www.php.net/manual/en/function.set-error-handler.php Edit -- https://master.php.net/note/edit/94908 Del: integrated -- https://master.php.net/note/delete/94908/integrated Del: useless -- https://master.php.net/note/delete/94908/useless Del: bad code -- https://master.php.net/note/delete/94908/bad+code Del: spam -- https://master.php.net/note/delete/94908/spam Del: non-english -- https://master.php.net/note/delete/94908/non-english Del: in docs -- https://master.php.net/note/delete/94908/in+docs Del: other reasons-- https://master.php.net/note/delete/94908 Reject -- https://master.php.net/note/reject/94908 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#163479) next »