Re: Does a call to trigger_error ever return?

From: Date: Sat, 26 Oct 2013 09:19:00 +0000
Subject: Re: Does a call to trigger_error ever return?
Groups: php.general 
Request: Send a blank email to php-general+get-322385@lists.php.net to get a copy of this message
On 26 Oct 2013 at 09:43, Peter West <lists@pbw.id.au> wrote: > As it says. I'm a complete php nube, but form what I can see, and from > some tests of interactive php, trigger_error is effectively an exit from > the flow of control. (I'm not sure where it exits to, or how it can be > made to change its mind.) > > So I need to confirm whether I have the right end of the stick, and I > need to know, especially, if I ever need to provide for a return from > trigger_error in the flow of code. If you use for example an unitialised variable, such as in: $i = $j; where $j had not yet been set to some value, then generally speaking program flow is interrupted, possibly some messages may be put out, and your program exits. If you use trigger_error then I'd guess (without having tried it) that something similar occurs. To alter the behaviour of your program either on a real error or one you trigger, you can use set_error_handler which allows you to tell PHP that you want to use your own error handling function rather than PHP's. For fuller information, have a look at: <http://www.php.net/manual/en/book.errorfunc.php> -- Cheers -- Tim

« previous php.general (#322385) next »