Re: Re: testing for empty array
| From: | Morgan Hughes | Date: | Thu, 01 Jan 1970 00:00:00 +0000 |
| Subject: | Re: Re: testing for empty array | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-126222@lists.php.net to get a copy of this message | ||
On Tue, 26 Nov 2002, Kyle Gibson wrote:
> > I have an array $keywords, how do I test to see if it is empty?
> > $keywords == '' seems to throw out an error.
>
> Maybe...
>
> if(count($keywords) <= 0)
> {
> //...
> }
I use sizeof(), which apparently is an alias to count(), and it works
fine, so count() should do the trick.
if ( !sizeof($keywords) )
print "keywords is empty";
--
Morgan Hughes
C programmer and highly caffeinated mammal.
kyhm@kyhm.com
ICQ: 79293356