RE: [PHP] checking if an array is empty
| From: | electroteque | Date: | Sun, 22 Sep 2002 01:44:59 +0000 |
| Subject: | RE: [PHP] checking if an array is empty | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-117133@lists.php.net to get a copy of this message | ||
yeh wicked thanks
-----Original Message-----
From: Michael Sims [mailto:mhsims@midsouth.rr.com]
Sent: Sunday, September 22, 2002 11:48 AM
To: php-general@lists.php.net
Cc: electroteque
Subject: Re: [PHP] checking if an array is empty
On Sun, 22 Sep 2002 11:09:16 +1000, you wrote:
>thats the thing , the word Array is what it returns even though there was
no
>input file.
Oh, I see. Without seeing your code, the best recommendation I have
is to loop through the array and remove the empty elements, then check
to see if the array is empty, something like this:
if (is_array($array)) {
foreach ($array as $key => $element) {
if ($element == "") {
unset($array[$key]);
}
}
}
if (empty($array)) {
...
}
Sorry if I'm still misunderstanding...