Now you can count the value of array without null values....

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
pavanjham
Forum Newbie
Posts: 1
Joined: Thu Jul 10, 2008 4:25 am

Now you can count the value of array without null values....

Post by pavanjham »

Hello Guies i am sending you the new function of php with name xcount which count the values of array without having the null values.here firstly you have to send the array parameter and after ,we are checking the value exist or not through the while looping with list case ,if value is exist here than its increment the counter and return the array value without null....

Code: Select all

function xcount($med) {
        while (list($key, $value) = each($med)) {
                if ($value) {
                        $count++;
                }
        }
        echo $count;
return $count;
}

Thanks
Post Reply