Description of several character processing functions in php _ PHP Tutorial

Source: Internet
Author: User
Description of several character processing functions in php. String segmentation and connection functions: Code: arrayexplode (stringdelimiter, stringdata) uses the string dellimiter to split data into an array and returns a function similar to the split () code string segmentation and connection functions:

Code:
Array explode (string delimiter, string data)

Use the string dellimiter to split data into an array and return
Similar functions: split ()

Code:
String implode (array data, string dellimiter)

In contrast to explode (), the array is connected to a long string using dellimiter.
Function alias: join ()

Code:
Array split (string pattern, string text [, integer limit])

Use the character in pattern matching as the separator to split the string text into arrays.
Optional limit parameter, which limits the number of segments

String codec functions:

Code:
String addslashes (string text)

Before the special characters in the string text, add "" to return. Special characters include (),("),().
Similar functions: quotemeta ()

Code:
String stripslashes (string text)

This is the opposite of the addslashes () function. remove the backslash code.

Code:
String quotemeta (string text)

Similar to addslashes (), the difference is that its special characters include:. + *? [] ^ () $

Code:
String escapeshellcmd (string command)

Add a backslash before all characters that may cause trouble in shell commands.
Used before exec (), system (), and other functions.

Code:
String mysql_escape_string (string text)

Escape an SQL string for secure use in mysql_query ()

HTML functions

Code:
String htmlentities (string text)

Convert all HTML entities

Code:
String htmlspecialchars (string [, int quote_style [, string charset])

Convert a specific character to an HTML entity
Quote_style: (ENT_COMPAT | ENT_QUOTES)
Quote_style default value: ENT_COMPAT conversion & <>
When quote_style is: ENT_QUOTES, "and

Code:
String trim (string text)

Removes the null characters at the beginning and end of the text string.

Code:
String ltrim (string text)

Removes the null character at the beginning of the string text.

Code:
String rtrim (string text)

Removes the null character at the end of the text string.

Code:
String chop (string text)

Alias of the rtrim () function

Delimiter code: array explode (string delimiter, string data) uses the string dellimiter to split data into an array and return a function similar to the following: split () code...

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.