check array values for all NULL

From: Date: Fri, 24 Aug 2007 03:02:57 +0000
Subject: check array values for all NULL
Groups: php.general 
Request: Send a blank email to php-general+get-261201@lists.php.net to get a copy of this message
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.

« previous php.general (#261201) next »