note 78569 added to language.operators.errorcontrol
| From: | root at mantoru dot de | Date: | Wed, 17 Oct 2007 19:13:40 +0000 |
| Subject: | note 78569 added to language.operators.errorcontrol | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-131461@lists.php.net to get a copy of this message | ||
The @ operator can also be prepended to literals (like strings), as they're also statements --
it will suppress any notice about uninitialized variables. If you want to silence a more complex
expression (@ is unary), use braces.
<?php
// variable interpolation
$str = @"Then I said: '$maybeunset'.";
// integer stuffs
$result = @2 * 3 / 0; // = @(2) * 3 / 0 - WRONG (warning)
$result = @(2 * 3 / 0); // RIGHT (no warning), $result is false
?>
@John Chilton's post: As omelnyk said, isset is a language construct and NOT a function, and an
@ token is not allowed there. @isset makes no sense, because under ANY circumstances isset stays
quiet.
Also, "using it with variables all the time" is a VERY bad idea, because it will make your
code EXTREMELY slow. Crank your error_reporting down then.
----
Server IP: 217.13.201.10
Probable Submitter: 85.176.240.124
----
Manual Page -- http://www.php.net/manual/en/language.operators.errorcontrol.php
Edit -- https://master.php.net/note/edit/78569
Del: integrated -- https://master.php.net/note/delete/78569/integrated
Del: useless -- https://master.php.net/note/delete/78569/useless
Del: bad code -- https://master.php.net/note/delete/78569/bad+code
Del: spam -- https://master.php.net/note/delete/78569/spam
Del: non-english -- https://master.php.net/note/delete/78569/non-english
Del: in docs -- https://master.php.net/note/delete/78569/in+docs
Del: other reasons-- https://master.php.net/note/delete/78569
Reject -- https://master.php.net/note/reject/78569
Search -- https://master.php.net/manage/user-notes.php