note 43918 deleted from function.array-count-values by tomsommer

From: Date: Thu, 08 Jul 2004 17:02:23 +0000
Subject: note 43918 deleted from function.array-count-values by tomsommer
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-72883@lists.php.net to get a copy of this message
Note Submitter: da@canaan.co.il ---- About checking if an array is empty or got in any of his keys (or all of them) a value. I just want to correct what "programmer at bardware dot de" wrote, though it was extremly helpful and smart just had a little typo :) So i'll take his function and make it more conveint and just correct so whoever you are can just copy&paste it to check it: $a[0] = ""; $a[1] = ""; $arrFoo=array_count_values($a); if( isset($arrFoo[""])) { if (count($a)==$arrFoo[""]) $allempty = count($a); } if($allempty) echo 'no values'; else echo 'got values'; Just play with the array and youll see that its working. Thanks again to "programmer at bardware dot de" :)

« previous php.notes (#72883) next »