Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to covert first character and every word of a string to Uppercase?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 105
    Comment on it

    Convert first character to uppercase:

    To convert first character of a string to uppercase we use a function in PHP ucfirst().

    Syntax:

    ucfirst(string)
    

    This function includes only one parameter that is the string whose first character you need to covert to uppercase.

    For Example:

    <?php
    echo ucfirst("hello this is the string");
    ?>
    

    Convert first character of each word to Uppercase:

    To convert first character of each word to uppercase we use a PHP function ucwords(string).

    Syntax:

    ucwords(string);
    

    In above function we have to give only one parameter which is the string. It will return the converted string.

    For example:

    <?php
    echo ucwords("hello this is the string");
    ?>
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: