php - @ only supresses a message, not a control flow -


i've found following example on php manual site:

some might think trigger_error throw() or err.raise construction, , @ works catch(){} 1 - in fact it's not.

function badgirl(){     trigger_error("shame on me",e_user_error);     return true; }  $sheis = @badgirl(); echo "you never see line - @ supress message, not control flow"; 

1) can please explain me why last line not displayed? because e_user_error breaks script execution?

2) if registered custom error handler set_error_handler , didn't exit or die in last line displayed?

  1. that error breaks execution, @ - silently, because e_user_error fatal error. try running example without error suppression operator - print:

    php fatal error: shame on me in /tmp/test.php on line 3

    fatal error: shame on me in /tmp/test.php on line 3

    more on error constants here

  2. sure, custom error handler can decide continue execution.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -