On Tue, March 20, 2007 11:08 am, Ford, Mike wrote:
>> what do you want with that '@' here?
>> that operator can be used to suppress error messages when calling
>> functions but not when using a variable

This is most definitely way wrong.

> What complete tosh!  @ is a unary operator, so can be applied to any
> expression.
>
> Proof:
>
>   <?php
>     echo "no @ --", $HTTP_GET_VARS['bogus'], "<br />\n";
>     echo "with @ --", @$HTTP_GET_VARS['bogus'], "<br />\n";
>   ?>
>
> Result:
>
>   no @ --
>   Warning: Undefined index: bogus in
> c:\www-lco\scripts_etc\lco\php\test.php on line 18
>
>   with @ --
>
>
> Also:
>
>   <?php
>     $a = 123;
>     echo "no @ --", $a/0, "<br />\n";
>     echo "with @ --", @($a/0), "<br />\n";
>   ?>
>
> Result:
>
>   no @ --
>   Warning: Division by zero in c:\www-lco\scripts_etc\lco\php\test.php
> on line 19
>
>   with @ --
>
>
> Not that I'm necessarily advocating this as a technique, but let's not
> spread disinformation!

While it has now been proven that @ is "more" than a function
error-suppressant, I suspect it may technically be a Language
Construct rather than a simple unary operator...

Not that I can come up with anything yet to prove it, as all my
examples so far were total syntax errors...

Although I did find an interesting anomoly...

What would you expect this to output?
<?php @ ?>

Hint:
I figured it would apply the @ to no expression at all and do nothing.
I was wrong.

I suppose I could try to read PHP source and figure all this out
someday...

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to