Re: On the usage of "@" (error control operator) [message #178207 is a reply to message #178206] |
Wed, 23 May 2012 13:50 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma:
|
Senior Member |
|
|
On 5/23/2012 9:17 AM, Leonardo Azpurua wrote:
> 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?
>
> --
>
>
My preference is to not use it at all and fix the error.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|