Re: Capitalization of variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 18, 2008 at 10:32 PM, Daniel Kolbo <kolb0057@xxxxxxx> wrote:

> you could explode the string by the " " space, then use the ucword function
> walking through the array, then implode


no, theres no need to use explode here.  ucwords() operates over an entire
string by itself.  if  however, you want to ensure that *only* the first
letter of each word is capitalized, you would first call strtolower(), as
so:

$streetAddr = "817 17th ST, DENVER COLORADO";
echo ucwords(strtolower($streetAddr));
// 817 17th St, Denver Colorado

-nathan

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux