Introduction to PHP Case conversion functions (Strtolower, Strtoupper) usage

Source: Internet
Author: User
This article describes the use of Strtolower and Strtoupper in PHP for case conversion functions, which are often encountered in character handling issues. If you need a friend, refer to it.

1, convert the string to the lowercase strtolower function: The function converts all characters passed in the string argument to lowercase and returns the string in a small form. Example:

     
     

Output: I want to fly

2, turn the character into an uppercase Strtoupper function: The function is the opposite of the Strtolower function, which converts the character of the passed character argument all to uppercase and returns the string in uppercase. Use the same as Strtolower ().

Here are two more useful functions.

3, converts the first character of the string to an uppercase Ucfirst function: The function is to change the first character of the string to uppercase, and the function returns the first character in uppercase string. Usage is similar to the Strtolower () function.

4. Converts the first character of each word in a string to uppercase Ucwords: The function capitalizes the first character of each word in the passed-in string. such as "Hello World", after the function is processed, will return "Hello Word." Usage is similar to Strtolower ().

  • 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.