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?
--
zzapper
Success for Techies and Vim,Zsh tips
http://SuccessTheory.com/
--
PHP General Mailing List
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?
Iterate through the string and count the number of capitalised letters.
You can do something like this
On 10/10/05, zzapper [EMAIL PROTECTED] wrote:
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
$a = array( 'fred', 'Fred', 'FRED' );
sort( $a );
echo $a[ 0 ];
--
Greg Donald
Zend
Image that there could be a string
fred
Fred
FRED
It isn't hard to do.
First of all I need to know that these are same which I can do with
strtolower
Also note strcasecmp for this task -
http://uk2.php.net/manual/en/function.strcasecmp.php
--
PHP General Mailing List
Greg Donald wrote:
On 10/10/05, zzapper [EMAIL PROTECTED] wrote:
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
$a = array( 'fred', 'Fred', 'FRED' );
sort( $a );
echo $a[ 0 ];
cute
On 10/10/05, Jochem Maas [EMAIL PROTECTED] wrote:
cute - but it doesn't always work e.g.:
$a = array( FrEDDie, fREDdIE, FReddie );
sort( $a );
echo $a[ 0 ]; // we want the 2nd item from the unsort array
Works for the sample data you first posted. *shrug*
--
Greg Donald
Zend Certified
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',
On 10/10/05, Jochem Maas [EMAIL PROTECTED] wrote:
I AM NOT THE OP THANKS, I'm quite capable of solving
such a problem without the help of people who don't bother
to think beyond 'sample data' ...
Yeah, everyone should read minds automatically, I agree.
It's bloody obvious that
the data in
Greg Donald wrote:
On 10/10/05, Jochem Maas [EMAIL PROTECTED] wrote:
I AM NOT THE OP THANKS, I'm quite capable of solving
such a problem without the help of people who don't bother
to think beyond 'sample data' ...
Yeah, everyone should read minds automatically, I agree.
I guess reading
9 matches
Mail list logo