On 10/10/05, zzapper <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Image that there could be a string
>
> fred
> Fred
> FRED
>
> First of all I need to know that these are same which I can do with 
> strtolower, but how could I tell
> that 'FRED' is 'most captilised?

<?php

$strings = array(
  'fred',
  'Fred',
  'fRED',
  'fReD'
);

print array_reduce($strings, 'mostUpper');

function mostUpper($a, $b) {
  return strlen(preg_replace('/[^[:upper:]]/', '', $a)) >
strlen(preg_replace('/[^[:upper:]]/', '', $b)) ? $a : $b;
}

?>

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

Reply via email to