Yeah, -1 for error suppression.

Also,

$value = isset($_GET["q"]) ? $_get['q'] : null;

is about 20% quicker than

$value = @$_GET["q"];

That's several tenths of one microsecond you can save with each
operation :P

Regards,
Hamish



On Sep 16, 3:09 pm, Cliff Black <[email protected]> wrote:
> I disagree with your solution Craig.
>
> As you have said, the @ merely suppresses the error - it does nothing to 
> clean your code, nor does it make your code conform to any PHP standards.
>
> Rather than bury the problem, why not fix it - and improve your coding 
> standard at the same time?
>
> ~ C
>
>
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of 
> craiganz
> Sent: Wednesday, 16 September 2009 3:00 p.m.
> To: NZ PHP Users Group
> Subject: [phpug] Re: PHP 5.3.0 error
>
> On Sep 16, 1:02 pm, "Nathan Kennedy" <[email protected]>
> wrote:
> > $value = array_key_exists('retry',$_GET)?$_GET['retry']:null;
>
> A much simpler solution is to use @:
>
> $value = @$_GET['retry'];
>
> Which produces exactly the same result as above, but suppresses all
> warning/notice messages.  The code is a lot cleaner, but it won't warn
> you if $_GET is undefined.
>
> -Craig
--~--~---------~--~----~------------~-------~--~----~
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]
-~----------~----~----~----~------~----~------~--~---

Reply via email to