This should work :
$default_array = array('key0'=>NULL,'key1'=>NULL,'key2'=>NULL,'key3'=>NULL);
$the_array = $default_array;
[ ... do some stuff ... ]
if($the_array === $default_array)
{
// handle it
}
brian wrote:
I have an array that is initialised with many keys and all values set
to NULL. I'd like to be able to test these values later to see if any
of them have been set. I tried:
if (!empty(array_values($the_array)))
but that's not allowed, so:
$array_check = array_values($the_array);
if (!empty($array_check))
but that doesn't work, either, because, though the values of *that*
array are all NULL, the array itself is not empty.
Now, i know that i can simply set some $var to TRUE whenever one of
the array vales is set. And i can also just test them in a loop. But
my curiosity has gotten the better of me.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php