Posted by Jason Barnett on 05/03/05 23:03
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).
[Back to original message]
|