Hi.
I'm not suggesting one use @ as a blanket solution, but in this case
it's simply a shorthand way of saying that you understand that the
array element might not exist (and that is OK).

The choice is:
  @$var
or
   ( array_key_exists('retry',$_GET) )? $var: null

The problem with the second solution is that you increase the
complexity of the code in an attempt to catch errors.  That doesn't
work.  What you end up doing is creating code that is harder to read
and the complexity just masks other higher-level errors and makes the
code more difficult to maintain.

Of course, the real answer is to always define variables (or cause
them to always be defined) and use neither of these techniques. But
you can't always do that because you don't always have control over
every part of a system.
-Craig

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
--~--~---------~--~----~------------~-------~--~----~
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