----- Original Message -----
From: "Liam Gibbs" <[EMAIL PROTECTED]>
To: "php list" <[EMAIL PROTECTED]>
Sent: Friday, March 07, 2003 12:24 PM
Subject: Re: [PHP] Min and max of array
> >you can sort it and get the values.
>
> I would, but I need the array in the same order. I can't sort it.
>
>
> -- ------------------
So what you really need is the min/max value of alpha numeric values in an
array? Well then here you go. This is the second function that I've given
away today. I hope it does what you need..
function max_alpha($array)
{
if (!is_array($array))
return false;
foreach($array as $key => $val)
{
if(!isset($prev_val))
$max_val = '';
$result = strcmp($val, $max_val);
if ($result > 0) // < for min value
{
$max_val = $val;
}
}
return $max_val;
}
- Kevin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php