PHP string Processing

Source: Internet
Author: User

PHP's string handling capabilities are very powerful, including:string Output
    • Echo (): Output one or more strings
    • print (): Output A string
    • printf (): Output formatted string
string Removal
    • trim (): Removes special symbols such as String end and end blanks, or sequences of specified characters
    • LTrim (): Remove special symbols such as the first whitespace of the string or specify a sequence of characters
    • RTrim (): Remove special symbols such as string trailing blanks or specify character sequences
    • Chop (): With RTrim ()
String Connection
    • Implode (): Use characters to combine the contents of an array into a single string
    • Join (): Same as implode ()
String Segmentation
    • explode (): Splitting another string with one string
    • str_split (): Splitting a string into an array
string Fetching
    • substr (): Get a portion of it from a string
    • strstr (): Finds the position of the first occurrence of a string in another string and returns all characters from that position to the end of the string
    • SUBCHR (): With Strstr ()
    • strrchr (): Finds the last occurrence of a string in another string and returns all characters from that position to the end of the string
string Substitution
    • substr_replace (): Replace part of a string with another string
    • str_replace (): Replaces other characters in a string with one string
string Calculation
    • strlen (): Gets the length of the string
    • Strpos (): Position the first occurrence of a string
    • Strrpos (): Position the last occurrence of the string
string XHTML formatted display
    • nl2br (): Converts line break N to XHTML line break <br/>
    • htmlspecialchars (): convert some special characters to HTML entities
    • Htmlspecialchars_decode (): Convert some HTML entities to special characters, htmlspecialchars () inverse function
String Storage (escaped)
    • Addslashes (): Adds an escape character to a special character.
    • Stripslashes (): Inverse function of addslashes ().

PHP string Processing

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.