check if any element of an array is not "empty"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hi,
as a result of one calculation I'm receiving an array where elements
could be 0 or date (as string yyyy-mm-dd hh:ii:ss).
I have to check if any of elements of the array is "date" or if all
elements of the array is 0?

If I try array_sum($result) I'll get 0 no matter what (0 + $string = 0).

I know I can do something like:
foreach($result as $value)
{
    if ($value !=0)
    {
       $alert = true;
    }
}

or

if (in_array($result, '-'))
{
    $alert = true;
}


but I was thinking if there is the function does that.

thanks for any help.

-afan

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux