PHP commonly used String functions

Source: Internet
Author: User
Tags md5 hash

http://www.w3school.com.cn/php/php_ref_string.asp
1, Addcslashes () returns a string that adds a backslash before the specified character
2, Addslashes () returns a string that adds a backslash before a predefined character
3. Explode () break the string to an array
4, implode () returns a string composed of data elements
5. Lcfirst () converts the first character of a string to lowercase
6, Md5_file () calculate the MD5 hash of the file
7. NL2BR () inserts HTML newline characters before each new line in the string
8. Number_format () format numbers in thousands
9, Parse_str () parse the query string into the variable
10, Str_ireplace () replace some characters in the string (not case sensitive)
11. Str_pad () fills the string with a new length
12, Str_repeat () Repeat the string for the specified number of times
13, Str_replace () replace some characters in the string (case sensitive)
14. Str_shuffle () randomly scrambles all characters in a string
15. Str_split () splits a string into an array
16. Str_word_count () calculates the number of words in a string
17, strcasecmp () compare two strings (not case sensitive)
18, strcmp () compare two strings (case sensitive)
19. Strip_tags () strips HTML and PHP tags from the string
20, stripcslashes () Delete backslash added by addcslashes () function
21, stripslashes () Delete backslash added by addslashes () function
22, Stripos () returns the position of the first occurrence of a string in a string (case insensitive)
23, Stristr () find the first occurrence of a string in a character (case insensitive)
24, strnatcasecmp () use a "natural sort" algorithm to compare two strings (case insensitive)
25, strnatcmp () use a "natural sort" algorithm to compare two strings (case sensitive)
26, STRNCASECMP () use a "natural sort" algorithm to compare two strings (case insensitive)
27, strncmp () use a "natural sort" algorithm to compare two strings (case sensitive)
28, Strpos () returns the position of the first occurrence of a string in another string (case sensitive)
29, STRRCHR () find the word Fulu the last time in a word
30, Strrev () reverse string
31, Strripos () find the last occurrence of a string in another character (case insensitive)
32, Strrpos () find the last occurrence of a string in a character (case sensitive)
33, STRSPN () returns the number of specific characters in the string that are contained.
34, Strstr () Find string first out (case sensitive) in another string
35. Strtok () splits the string into smaller strings
36. Strtolower () Converts a string to a lowercase letter
37. Strtoupper () Converts a string to a case mother
38, Strtr () converts a specific character in a string
39, substr () returns part of a string
40, Substr_count () count the number of occurrences of a substring in a string
41, Substr_replace () Replace a division of a string with a string
42. Ucfirst () converts the first character of a string to uppercase
43. Ucwords () converts the first character of each word in a string to uppercase

PHP commonly used String functions

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.