Re: foreach behavior and error suppression (@foo)

From: Date: Tue, 03 Jul 2001 08:41:14 +0000
Subject: Re: foreach behavior and error suppression (@foo)
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-58779@lists.php.net to get a copy of this message
On Tue, 3 Jul 2001, Stanislav Malyshev wrote: > Well, if you are around this with @, why not with if(is_array())? What looks better and is easier to read?: 1.: if (is_array($ar)) { foreach ($ar as $element) { } } 2.: @foreach ($ar as $element) { } I clearly see some usefulness here. It makes code less cluttered. However, as foreach is a language construct, I do not think the @ should work on it. But, making foreach threat NULL variables as empty arrays, would be a goof thing IMO. regards, Derick

« previous php.dev (#58779) next »