php-String Correlation function

Source: Internet
Author: User

1,strlen: Statistical string length, commonly used in loops and other functions, when it is important to determine when a string ends

2,strpos: The search string appears for the first time in another string and succeeds in returning the first occurrence of a character in a string
Strpos (' Hello ', ' o '); Search o first appears in Hello's position

3,str_shuffle: Randomly scrambling a string

4,str_split: Converts a string to an array.
Str_split (' Hello ') is converted into an array (' H ', ' e ', ' l ', ' l ', ' o ');
There is an optional parameter that specifies the value of the array to convert to a certain length character, str_split (' Hello ', 2) converts the array (' he ', ' ll ', ' O ').

5,explode: Use one string to split another string, in order: The separated string is placed behind.
Explode (', ' Hello ') after split: Array (' Hello ')

6,STRCHR, alias Strstr: The search string appears for the first time in another string. Successful returns the string and the remaining parts
Strstr (' I Love you ', ' Love ') return love to You

7,strrchr-finds the last occurrence of the specified character in the string, and succeeds returns the character and the remainder.
STRRCHR (' acdef.class.php ', ' s. ') returns s.php commonly used to determine file suffix names

8,strrev: String inversion

9,substr_replace: The substring of the replacement string http://php.net/manual/zh/function.substr-replace.php
4 parameters, First: replaced String, second: replacement string, Third: Start position, fourth: length

10,SUBSTR: Returns a substring of a string
substr (' Abcdefgh ',-5) return to DEFGH

php-String Correlation function

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.