Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #6130

Re: On the usage of "@" (error control operator)

Path csiph.com!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail
From "Leonardo Azpurua" <leonardo@exmvps.org>
Newsgroups comp.lang.php
Subject Re: On the usage of "@" (error control operator)
Date Wed, 23 May 2012 10:22:05 -0430
Organization A noiseless patient Spider
Lines 54
Message-ID <jpith6$c84$1@dont-email.me> (permalink)
References <jpio02$942$1@dont-email.me> <jpir8f$til$1@dont-email.me>
Injection-Date Wed, 23 May 2012 14:51:18 +0000 (UTC)
Injection-Info mx04.eternal-september.org; posting-host="mwEy0s2LD/Fop7IgoIuFPw"; logging-data="12548"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19j0Vku0mTjiy02Bd6rH7LVYJz6NOHJ78s="
X-MimeOLE Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646 Format=Flowed; Response
X-Newsreader Microsoft Outlook Express 6.00.2900.2180
Cancel-Lock sha1:b1UZHWhhX06eAAnwvWlW+yQKiBM=
X-Priority 3
X-MSMail-Priority Normal
Xref csiph.com comp.lang.php:6130

Show key headers only | View raw


"Shake" <QUITAESTO@QUITAESTO.NOES> escribió en el mensaje 
news:jpir8f$til$1@dont-email.me...
> 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.

Thanks.

Is there any chance that a type casting error occurs in such a statement?

--

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

On the usage of "@" (error control operator) "Leonardo Azpurua" <leonardo@exmvps.org> - 2012-05-23 08:47 -0430
  Re: On the usage of "@" (error control operator) Jerry Stuckle <jstucklex@attglobal.net> - 2012-05-23 09:50 -0400
    Re: On the usage of "@" (error control operator) "Leonardo Azpurua" <leonardo@exmvps.org> - 2012-05-23 10:19 -0430
      Re: On the usage of "@" (error control operator) Jerry Stuckle <jstucklex@attglobal.net> - 2012-05-23 12:12 -0400
        Re: On the usage of "@" (error control operator) "Leonardo Azpurua" <leonardo@exmvps.org> - 2012-05-23 14:15 -0430
          Re: On the usage of "@" (error control operator) Jerry Stuckle <jstucklex@attglobal.net> - 2012-05-23 16:14 -0400
  Re: On the usage of "@" (error control operator) Shake <QUITAESTO@QUITAESTO.NOES> - 2012-05-23 16:12 +0200
    Re: On the usage of "@" (error control operator) "Leonardo Azpurua" <leonardo@exmvps.org> - 2012-05-23 10:22 -0430
      Re: On the usage of "@" (error control operator) Shake <QUITAESTO@QUITAESTO.NOES> - 2012-05-23 17:11 +0200
        Re: On the usage of "@" (error control operator) "Leonardo Azpurua" <leonardo@exmvps.org> - 2012-05-23 10:44 -0430
    Re: On the usage of "@" (error control operator) Jerry Stuckle <jstucklex@attglobal.net> - 2012-05-23 12:13 -0400
  Re: On the usage of "@" (error control operator) Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2012-05-24 22:26 +0200

csiph-web