String processing functions

Source: Internet
Author: User
: This article mainly introduces string processing functions. if you are interested in the PHP Tutorial, you can refer to it. 1. string output function

Echo

Print

High efficiency without echo, not recommended

Die ()

Exit and print string a, or directly die

Printf

Format a string

Sprintf

Returns the formatted string.

2. common string formatting functions

Ltrim ()

Delete white space on the left

Rtrim

Delete the white space on the right

Trim

Remove blank spaces on both sides

Str_pad

Use another string to fill the string with the specified length

Strtolower

Converts a string to lowercase.

Strtopper

Converts a string to uppercase.

Ucfirst

Converts the initial character of a string to uppercase.

Usword

Converts the first letter of each word in a string to uppercase.

Nl2br

Insert the HTML line feed mark before all new lines of the string

Htmlentities

Convert objects to tags

Htmlspecialchars

Convert tags to objects

Stripslashes

Delete backslash

Strip_taps

Delete tags

Md5

Password encryption

3. string comparison functions

Strcmp (a, B)

Sort by byte. if a is smallerB, Returns a negative number. ifAIf the value is greater than B, a positive number is returned. if the two values are equal, 0 is returned.

Strcasecmp ()

Same as above, but not case sensitive

Strnatcmp ()

Sort by natural number

The above introduces the string processing functions, including the content, hope to be helpful to friends who are interested in the PHP Tutorial.

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.