Re: [PHP] Testing for an empty array (with null values)

2005-10-01 Thread Jochem Maas
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),

[PHP] Testing for an empty array (with null values)

2005-09-30 Thread zzapper
Hi, I can use if (count($somearray) 0) to test for an empty array. 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). Any ideas -- zzapper Success for Techies and Vim,Zsh tips http://SuccessTheory.com/

Re: [PHP] Testing for an empty array (with null values)

2005-09-30 Thread Emil Novak
Better use is empty(), which supports array as parameter: $test = array(); if(empty($test)) // true { // code... } else // false { } Emil Novak, Slovenia, EU -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php