A summary of several character functions in PHP

Source: Internet
Author: User
Here is a summary of several character functions in PHP, a summary:

1) Ucfirst
Capitalize the first letter, such as
$string = "This is my web development blog";

echo Ucfirst ($string);

Output:this is my web development blog

2) Lcfirst, lower the initial letter to lowercase
$string = "This is my Web development Blog";

echo Lcfirst ($string);

Output:this is my Web development Blog

3) Strtoupper, capitalize the entire string
$string = "This is my web development blog";

echo Strtoupper ($string);

Output:this is MY WEB development BLOG

4) Strtoplower the entire string to lowercase
$string = "This is MY WeB development BLoG";

echo Strtolower ($string);

Output:this is my web development blog

5) Ucwords (), you can capitalize the first letter of each word in a sentence, such as
$string = "This is my web development blog";

echo Ucwords ($string);

Output:this is My Web development Blog
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.