Re: Error suppression operator (@)

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

 



GamblerZG wrote:
I would like to know, whether using @ is a good practice. For example, I have an array of unknown length $array.
Is it all right write something like this:


@list($first, $second) = $array;

or is it better to do length check?

Using @ is good practice in any case where you simply *don't care* whether you had an error or not. So if your scripts don't need a value stored in $first or in $second, then you can use the @ operator. But don't use @ in any case where you need to trap for errors (e.g. validating input from $_GET / $_POST).


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