RE: [PHP] Empty elements in array
| From: | Christensen, BruceX R | Date: | Tue, 01 Aug 2000 01:34:57 +0000 |
| Subject: | RE: [PHP] Empty elements in array | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-9333@lists.php.net to get a copy of this message | ||
Try this:
while (list(,$value) = each($array)) {
if (!is_empty($value)) {
// do stuff
}
}
You could also use if ($value) instead of the current if statement as long
as the array values are nonzero (assuming you want to process elements that
equal zero). The if ($value) form will skip over array elements that equal
0.
--Bruce
Bruce Christensen
Intel Corporation
brucex.r.christensen@intel.com
-----Original Message-----
From: Tim [mailto:tj198@soton.ac.uk]
Sent: Monday, July 31, 2000 6:33 PM
To: php-general@lists.php.net
Subject: [PHP] Empty elements in array
I have five elements in an array, and I have a while loop acting on the
array. However, I only want the non-empty elements to be processed by the
while loop - how do I tell it to ignore the empty elements?
Thanks in advance for any help... :o)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net