Questions tagged [ucfirst]

ucfirst, short for 'Upper Case First', is a function which replaces the first letter of words in a string by their uppercase equivalent.

ucfirst (short for Upper Case First is a function for making a string's first character uppercase. For more details, see the PHP manual page.

35 questions
-1
votes
1 answer

How do you uppercase only certain parts of a single string that's in format "Town comma Initials"?

I have a single location field where people can enter whatever they want, but generally they will enter something in the format of "Town, Initials". So for example, these entries... New york, Ny columbia, sc charleston washington, DC BISMARCK,…
user3304303
  • 1,027
  • 12
  • 31
-1
votes
2 answers

Most efficient solution: trim, capitalise and explode by comma for a string

I have a string like so: Quaint village location, seaside views, four bedrooms I need to do the following: Take each comma separated item and add it into an array Remove whitespace from beginning and end Capitalise the first letter So for…
Francesca
  • 26,842
  • 28
  • 90
  • 153
-1
votes
6 answers

Uppercase first letter and rest lower

Ive been looking around for a way in PHP to have a string converted, so that the first letter becomes uppercase and the rest lower case. At the moment I am doing what I believe is the standard way: ucfirst(strtolower($string)); But I have found…
Just Lucky Really
  • 1,341
  • 1
  • 15
  • 38
-2
votes
3 answers

Capitalize city name from database with ucfirst in php?

is it possible to make the {CITY} output to be capitalized with for example ucfirst? Can this code be altered in some way to make it capitalized?
P.Membas
  • 33
  • 6
-4
votes
4 answers

Capitalize First word in PHP

As i am using PHP, So problem comes to me that how can i captilized the first Letter In this Code. username.'' ?>
user2246395
  • 31
  • 1
  • 2
1 2
3