String manipulation Functions _php Tutorial

Source: Internet
Author: User
The function of string manipulation in PHP3.0 is much more, and it is important to have the following:
(1) echo,print,printf,sprintf
Used for the output string. If there is a variable name in the string, it is replaced with its value. The latter two functions are similar to C's with the same name function.
 
(2) STRCHR, strlen, Strtok, STRRCHR, Strrev, Strstr, Strtolower, Strtoupper, substr, Ucfirst
String manipulation functions, some of which have exactly the same meaning as the function in C. Strrev is to flip a string. Strtolower and Strtoupper are converting strings to lowercase and uppercase. Ucfirst is to capitalize the first character of a string. Substr is a substring of the returned string, using: substr (String, header, length). The head position is calculated from 0. If it is negative, it is the meaning of the forward number from the tail.
 
(3) Chr,ord
function with the same name.
 
(4) Explode,implode,join
The function associated with the array. Explode (string, delimiter) returns an array that separates the strings from the delimiters. Implode (array, delimiter) returns a string that divides the elements of an array into delimiters. Joins have the same meaning as implode.
 
(5) Chop
Handles whitespace at the end of a string.
 
(6) Htmlspecialchars
Replace the HTML special characters with their names, such as "<" into "<".
 
(7) NL2BR
Each carriage return in HTML is preceded by a "
".
 
(8) Addslashes,stripslashes
Add "" and remove "to the string as needed, and for some databases, you must add and remove the characters you want to query before you can query.
 
(9) Parse_str
Parse a string of type "Name1=value1&name2=value2&amp ..." into some variable.
 
For example: Parse_str ("a=1&b=2"); Generate $ A and $b two variables, respectively. If there are two pairs of name/value names that are part of the same, then the next value overrides the previous one. If both pairs have "[]" tails, such as "a[]=1&a[]=2", an array of $ A is generated and two elements are each.

http://www.bkjia.com/PHPjc/445599.html www.bkjia.com true http://www.bkjia.com/PHPjc/445599.html techarticle The string manipulation function in PHP3.0 is much more, and it is important to have the following: (1) echo,print,printf,sprintf is used for output strings. If there is a variable name in the string, it is replaced with its value. After two ...

  • Related Article

    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.