RE: [PHP] isset
| From: | Richard Lynch | Date: | Mon, 16 Apr 2007 22:50:15 +0000 |
| Subject: | RE: [PHP] isset | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-253071@lists.php.net to get a copy of this message | ||
On Mon, April 16, 2007 5:35 pm, Tim Earl wrote:
> What about in the following context?
>
> $arr = array();
> If (!empty($arr)) { }
>
> This is where i have found it to be the most usefull...
If I'm already certain that it's an array, I just use 'count' personally.
'empty' takes a mixed data type, and could return TRUE for, say, 'foo'
even though you are expecting an array there.
I think it's a better practice to use the "right" weapon and use
count() on an array to see if it's empty or not.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?