On the usage of "@" (error control operator)
- From: "Leonardo Azpurua" <leonardo@xxxxxxxxxx>
- Date: Wed, 23 May 2012 08:47:38 -0430
Hi,
A few weeks ago, I wrote this sentence:
@$retVal = $this->lastfetch[$ndx];
Yesterday, browsing the manual, I found this paragraph:
"PHP supports one error control operator: the at sign (@). _When prepended
to an expression_ in PHP, any error messages that might be generated by that
expression will be ignored."
and, a few lines further:
"A simple rule of thumb is: if you can take the value of something, you can
prepend the @ operator to it."
Since an assigment is not an expression, the required syntax should be:
$retVal = @$this->lastfetch[$ndx];
But both forms work.
Is there any reason to prefer one above the other?
--
.
- Follow-Ups:
- Re: On the usage of "@" (error control operator)
- From: Thomas Mlynarczyk
- Re: On the usage of "@" (error control operator)
- From: Jerry Stuckle
- Re: On the usage of "@" (error control operator)
- Prev by Date: Re: in_array performance in unsorted vs sorted array
- Next by Date: Re: On the usage of "@" (error control operator)
- Previous by thread: in_array performance in unsorted vs sorted array
- Next by thread: Re: On the usage of "@" (error control operator)
- Index(es):
Relevant Pages
|