You are here: Re: Error Suppression with '@' « PHP « IT news, forums, messages
Re: Error Suppression with '@'

Posted by Mike Milano on 10/04/19 11:23

my guess is that he is just trying to avoid errors in case the variable
is not an actual array.

arrays can easily be tested for by using: is_array( $myarray );

another way to manage arrays is to initialize them before you do
anything with them. i.e.: $myarray = array();

this way if you need to call an array specific function which would
normally throw an error because it's expecting an array as an argument,
it won't choke.

everyone is entitled to their own opinion, but i would just call
suppressing errors on EVERY array function just plain lazy and very poor
coding practice.



Justin Burger wrote:
> Good Morning,
> I was having a discussion with a fellow PHP Developer this morning and he
> mentioned that he put's an '@' sign in front of all function calls, and
> every time he accesses an array;
>
> I know that this is sloppy, and dangerous, but I don't know exactly what
> this exposes him to, can any one give me any real world examples of why
> this is bad, so I can relate it to his code?
>
> php.net does not have much information about this. It seems like
> suppressing errors, rather then catching them is problematic.
>
>
> Thanks Again.
>
> Justin.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация