Re:Five reasons why the PHP silence operator @ should be avo...
by artemgoutsoul on Saturday January 12, 2013 @01:20PM
(#5048412)
Some negative comments about the @-operator seem to be very religious. It's just a tool that one can use for good or for evil. Many of the reasons not to use @ described are valid, but there are cases when it makes much cleaner code. E.g. instead of doing:
if (array_key_exists($key, $a) && $a[$key] == $value) dostuff();
you can do:
if (@$a[$key] == $value) dostuff();
This works really well when you don't care whether $a[$key]is present or not, and when you care only whether it contains a certain $value. In complex comparisons the code readability difference is huge!
[ Parent
| on HN ]
There are no comments on this comment yet.