RE: [PHP] Capitalising Personal Names

From: Date: Fri, 28 Feb 2003 11:24:59 +0000
Subject: RE: [PHP] Capitalising Personal Names
Groups: php.general 
Request: Send a blank email to php-general+get-137542@lists.php.net to get a copy of this message
Hi Danny, > > I need to clean up the capitalisation of user-entered personal names. > > Well it's hardly rocket science - a flick through the manual and I > came up with : > $name=ucwords(strtolower($name)); While that would work in many cases, how do you catch exceptions such as the following? <?php $names[] = "Ludwig van Beethoven"; $names[] = "Ronald MacDonald"; $names[] = "Alexis de Tocqueville"; $names[] = "Tim O'Reilly"; foreach ($names as $name) echo $name. " -> ". ucwords(strtolower($name)). "<br />"; ?> Cheers Jon

« previous php.general (#137542) next »