Descriptions of several character processing functions in php

Source: Internet
Author: User

String segmentation and connection functions:

Code:
Array explode (string delimiter, string data) uses the string dellimiter to split data into an array and return
Similar function: split () code:
String implode (array data, string dellimiter) is opposite to explode (). It concatenates an array with dellimiter into a long string.
Function alias: join () code:
Array split (string pattern, string text [, integer limit]) uses the matching pattern character as the separator and splits the string text into arrays.
Limit: an optional parameter that limits the number of segments to be separated. String codec function: code:
String addslashes (string text) is returned by adding "" Before special characters in string text. special characters include (),("),().
Similar function: quotemeta () code:
The string stripslashes (string text) and addslashes () functions are the opposite. Remove the backslash encoding code:
String quotemeta (string text) is similar to addslashes (). The difference is that its special characters include:. + *? [] ^ () $ Code:
String escapeshellcmd (string command) adds 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) escapes an SQL string to safely use the code for functions related to mysql_query () HTML:
String htmlentities (string text) converts all HTML Entity Codes:
String htmlspecialchars (string [, int quote_style [, string charset]) converts 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, in addition to converting the above characters, it also converts "and code:
String trim (string text) removes the empty character code at the start and end of the string text:
String ltrim (string text) removes the empty character code at the beginning of the string text:
String rtrim (string text) removes the empty character code at the end of the string text:
Alias of the string chop (string text) function rtrim ()

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.