Once again, I disagree. Catching of errors and dealing to them is critical to developing any application. Simply ignoring or suppressing issues is not only amateur, it's potentially going to create flaky products.
Being lazy and ignoring the issue is not the answer. PHP has allowed developers to ignore standards - this does not mean it's the correct way of doing it. In fact, it has the effect of creating sloppy developers - something PHP6 is desperately trying to change. Personally I develop all my PHP applications to conform to PHP_STRICT. I pass on what I learn and promote the same standards as it only creates better developers. Each to their own, but I know who I'd rather hire ;) ~ C -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of craiganz Sent: Wednesday, 16 September 2009 3:49 p.m. To: NZ PHP Users Group Subject: [phpug] Re: PHP 5.3.0 error 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] -~----------~----~----~----~------~----~------~--~---
