Re: Error Suppression with '@'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux