zzapper wrote:
Hi,
I can use
if (count($somearray) > 0) to test for an empty array.
why don't you test it.
$a = array();
$b = array(null, null, null);
$c = array(false, false);
$d = array(1, 1, 1);
echo "array \$a: \n---------------------------\n";
var_dump(empty($a), count($a), array_filter($a), array_values($a));
echo "array \$b: \n---------------------------\n";
var_dump(empty($b), count($b), array_filter($b), array_values($b));
echo "array \$c: \n---------------------------\n";
var_dump(empty($c), count($c), array_filter($c), array_values($c));
echo "array \$d: \n---------------------------\n";
var_dump(empty($d), count($d), array_filter($d), array_values($d));
It is possible to have an array with null values which is effectively empty but
fails the above as
it's count (I belive is greater than 0).
look above.
Any ideas
plenty. hopefully the code above give you a few too :-)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php