Re: [PHP] check if any element of an array is not "empty"

2008-05-01 Thread tedd
At 3:36 PM -0500 4/30/08, afan pasalic wrote: hi, as a result of one calculation I'm receiving an array where elements could be 0 or date (as string -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

Re: [PHP] check if any element of an array is not "empty"

2008-05-01 Thread Richard Heyes
i dont really see how that gets him the answer without at least checking the number of elements in the array after filtering it w/ array_filter; which if he wanted to reuse in several places would make sense to write a simple function for anyway.. Yes, on both counts. -- Richard Heyes +---

Re: [PHP] check if any element of an array is not "empty"

2008-05-01 Thread Robin Vickery
2008/4/30 Nathan Nobbe <[EMAIL PROTECTED]>: > On Wed, Apr 30, 2008 at 2:58 PM, Richard Heyes <[EMAIL PROTECTED]> wrote: > > > but I was thinking if there is the function does that. > >> > > > > array_filter(). Note this: > > > > "If no callback is supplied, all entries of input equal to FALSE

Re: [PHP] check if any element of an array is not "empty"

2008-04-30 Thread Nathan Nobbe
On Wed, Apr 30, 2008 at 2:58 PM, Richard Heyes <[EMAIL PROTECTED]> wrote: > but I was thinking if there is the function does that. >> > > array_filter(). Note this: > > "If no callback is supplied, all entries of input equal to FALSE (see > converting to boolean) will be removed." > > http://uk3.p

Re: [PHP] check if any element of an array is not "empty"

2008-04-30 Thread afan pasalic
yup! that's the one :D thanks richard Richard Heyes wrote: >> but I was thinking if there is the function does that. > > array_filter(). Note this: > > "If no callback is supplied, all entries of input equal to FALSE (see > converting to boolean) will be removed." > > http://uk3.php.net/manual/

Re: [PHP] check if any element of an array is not "empty"

2008-04-30 Thread Richard Heyes
but I was thinking if there is the function does that. array_filter(). Note this: "If no callback is supplied, all entries of input equal to FALSE (see converting to boolean) will be removed." http://uk3.php.net/manual/en/function.array-filter.php -- Richard Heyes +

Re: [PHP] check if any element of an array is not "empty"

2008-04-30 Thread Nathan Nobbe
On Wed, Apr 30, 2008 at 2:36 PM, afan pasalic <[EMAIL PROTECTED]> wrote: > hi, > as a result of one calculation I'm receiving an array where elements > could be 0 or date (as string -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

[PHP] check if any element of an array is not "empty"

2008-04-30 Thread afan pasalic
hi, as a result of one calculation I'm receiving an array where elements could be 0 or date (as string -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 k