Current Location: Home> Function Categories> ucfirst

ucfirst

Set the first character of the string to uppercase
Name:ucfirst
Category:String
Programming Language:php
One-line Description:Converts the first character in the string to uppercase.

Definition and usage

ucfirst() function converts the first character in the string to uppercase.

Related functions:

  • lcfirst() - Convert first character in a string to lowercase
  • strtolower() - Convert strings to lowercase
  • strtoupper() - Convert string to uppercase
  • ucwords() - Convert the first character of each word in a string to uppercase

Example

Convert the first character of "hello" to uppercase:

 <?php
echo ucfirst ( "hello world!" ) ;
?>

Try it yourself

grammar

 ucfirst( string )
parameter describe
string Required. Specifies the string to be converted.
Similar Functions
  • Find the location where the string first appears (case insensitive) stripos

    stripos

    Findthelocationwhere
  • Get the string length strlen

    strlen

    Getthestringlength
  • Escape metacharacter set quotemeta

    quotemeta

    Escapemetacharacters
  • Escape characters in a string using backslashes in C style addcslashes

    addcslashes

    Escapecharactersinas
  • Parses entered characters according to the specified format sscanf

    sscanf

    Parsesenteredcharact
  • Generate single-byte strings from numbers chr

    chr

    Generatesingle-bytes
  • Tag split string strtok

    strtok

    Tagsplitstring
  • Randomly disrupt a string str_shuffle

    str_shuffle

    Randomlydisruptastri
Popular Articles