Re: Capitalization of variable

From: Date: Thu, 19 Jun 2008 04:38:30 +0000
Subject: Re: Capitalization of variable
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-275564@lists.php.net to get a copy of this message
On Wed, Jun 18, 2008 at 10:32 PM, Daniel Kolbo <kolb0057@umn.edu> 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

« previous php.general (#275564) next »