I think ucfirst() only does the first character of the string...

ucwords() will do all the parts of the name.

The only shortcoming I've found is if people put in a middle initial and
add a period to it, or put a nickname in quotes... ucwords() skips
those.


-----Original Message-----
From: Opec Kemp [mailto:[EMAIL PROTECTED]] 
Sent: Monday, July 23, 2001 9:53 PM
To: PHP Junkie
Cc: PHP List
Subject: RE: [PHP] Capitalize Function ??


The function that you want is called: ucfirst()

http://www.php.net/manual/en/function.ucfirst.php

To make sure that string are consistant you might want to convert all
characters in the string to Lower case first then call this function.
This will ensure that stuff like "JoHn sMITH" gets converted to "John
Smith" consistantly.

> -----Original Message-----
> From: PHP Junkie [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 24, 2001 11:39 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Capitalize Function ??
>
>
> I know this one will be an easy one ...
>
> I'm taking in first name and last name data into a MySQL db through a 
> form. Users sometimes don't capitalize their first and last names when

> entering the data.  Is there a function to clean this up for 
> consistency?  If so, what is the name of the function that performs 
> this?
>
> Thanks in advance,


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED] To
contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to