sungpeng Posted May 11, 2009 Share Posted May 11, 2009 while($index<=1000) { $arr =$_SESSION['hello'][$index]; echo count($arr); } Check I need a function that will count the number of $arr that is not empty. If got 10 $arr that is not empty or = zero, display 10. The above code display 00000000100000010000. This is not I need. Link to comment https://forums.phpfreaks.com/topic/157661-solved-count-the-number-of-variable-that-is-not-empty/ Share on other sites More sharing options...
Ken2k7 Posted May 11, 2009 Share Posted May 11, 2009 $count = 0; while ($index <= 1000) { if (empty($_SESSION['hello'][$index])) $count++; $index++; } echo $count; Link to comment https://forums.phpfreaks.com/topic/157661-solved-count-the-number-of-variable-that-is-not-empty/#findComment-831373 Share on other sites More sharing options...
sungpeng Posted May 11, 2009 Author Share Posted May 11, 2009 Ok Thank Link to comment https://forums.phpfreaks.com/topic/157661-solved-count-the-number-of-variable-that-is-not-empty/#findComment-831377 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.