FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » On the usage of "@" (error control operator)
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: On the usage of "@" (error control operator) [message #178216 is a reply to message #178208] Wed, 23 May 2012 16:13 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 5/23/2012 10:12 AM, Shake wrote:
> El 23/05/2012 15:17, Leonardo Azpurua escribió:
>> 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?
>>
>
> Both forms works, but not both forms are the same:
>
>
> $retVal = @$this->lastfetch[$ndx];
> (....errors ignored....)
>
> @$retVal = $this->lastfetch[$ndx];
> (.........Errors ignored.........)
>
>
> Perhaps in some cases "$retVal" could throw a type casting error or
> something of this kind.
>
> Rgds.

What type casting error? Or are you just guessing?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: in_array performance in unsorted vs sorted array
Next Topic: multiple image upload and thumbnail display
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 16:41:41 GMT 2024

Total time taken to generate the page: 0.04620 seconds