470,855 Members | 1,303 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,855 developers. It's quick & easy.

min and max functions

If I have a series of integers, how do I get the minimum (or maximum) value
NOT equaled to 0??
--
Alexander Ross
al******@bleen.net
Jul 16 '05 #1
4 2544
Alexander Ross wrote:
If I have a series of integers, how do I get the minimum (or maximum) value
NOT equaled to 0??


Are they in an array? comma separated string? other?

--
Justin Koivisto - sp**@koivi.com
PHP POSTERS: Please use comp.lang.php for PHP related questions,
alt.php* groups are not recommended.

Jul 16 '05 #2
other ... 3 variables with integer values

"Justin Koivisto" <sp**@koivi.com> wrote in message
news:yV****************@news7.onvoy.net...
Alexander Ross wrote:
If I have a series of integers, how do I get the minimum (or maximum) value NOT equaled to 0??


Are they in an array? comma separated string? other?

--
Justin Koivisto - sp**@koivi.com
PHP POSTERS: Please use comp.lang.php for PHP related questions,
alt.php* groups are not recommended.

Jul 16 '05 #3
> If I have a series of integers, how do I get the minimum (or maximum)
value
NOT equaled to 0??

You could stuff the values into an array and run array_filter on it
(removing 0 values). Then min/max on the array will give you the requested
result..
Martin
Jul 16 '05 #4

"Alexander Ross" <al******@bleen.net> wrote in message
news:YNRVa.19379$uu5.1172@sccrnsc04...
If I have a series of integers, how do I get the minimum (or maximum) value NOT equaled to 0??
--
Alexander Ross
al******@bleen.net


Hope I've got this one right, but I'd put the numbers in to an array,
perform a sort and then do an array_pop and an array_shift to take the first
and elements from the array - If either number was a zero, I'd perform the
the same routines again as they take the last and first element from the
array hence eventually you would get the lowest and highest number.

I've not tested this idea though for negative numbers but hope it gives you
some direction.
Jul 16 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by hokiegal99 | last post: by
99 posts views Thread by David MacQuigg | last post: by
21 posts views Thread by Rubén Campos | last post: by
17 posts views Thread by cwdjrxyz | last post: by
2 posts views Thread by Bryan Olson | last post: by
23 posts views Thread by Timothy Madden | last post: by
14 posts views Thread by v4vijayakumar | last post: by
7 posts views Thread by Immortal Nephi | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.