Re: Error suppression operator (@)
| From: | Jason Barnett | Date: | Tue, 03 May 2005 20:03:08 +0000 |
| Subject: | Re: Error suppression operator (@) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-214382@lists.php.net to get a copy of this message | ||
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).