min and max functions

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Alexander Ross

    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
    alexross@bleen. net


  • Justin Koivisto

    #2
    Re: min and max functions

    Alexander Ross wrote:
    [color=blue]
    > If I have a series of integers, how do I get the minimum (or maximum) value
    > NOT equaled to 0??[/color]

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

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

    Comment

    • Alexander Ross

      #3
      Re: min and max functions

      other ... 3 variables with integer values

      "Justin Koivisto" <spam@koivi.com > wrote in message
      news:yVRVa.664$ m3.33360@news7. onvoy.net...[color=blue]
      > Alexander Ross wrote:
      >[color=green]
      > > If I have a series of integers, how do I get the minimum (or maximum)[/color][/color]
      value[color=blue][color=green]
      > > NOT equaled to 0??[/color]
      >
      > Are they in an array? comma separated string? other?
      >
      > --
      > Justin Koivisto - spam@koivi.com
      > PHP POSTERS: Please use comp.lang.php for PHP related questions,
      > alt.php* groups are not recommended.
      >[/color]


      Comment

      • Martin C. Petersen

        #4
        Re: min and max functions

        > If I have a series of integers, how do I get the minimum (or maximum)
        value[color=blue]
        > NOT equaled to 0??[/color]
        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


        Comment

        • Randell D.

          #5
          Re: min and max functions


          "Alexander Ross" <alexross@bleen .net> wrote in message
          news:YNRVa.1937 9$uu5.1172@sccr nsc04...[color=blue]
          > If I have a series of integers, how do I get the minimum (or maximum)[/color]
          value[color=blue]
          > NOT equaled to 0??
          > --
          > Alexander Ross
          > alexross@bleen. net
          >
          >[/color]

          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.


          Comment

          Working...