String functions commonly used in PHP str

Source: Internet
Author: User
Tags strcmp

1          string Case function Strtoupper ($STR) strtolower ($STR)2String cut function Explode (',', $STR) Join (',', $str) Implode (',', $str)3 string length function strlen ($STR)4String repetition function str_repeat ($STR,2)5 string First character uppercase Ucfirst ($STR)6 string Word first character uppercase ucwords ($STR)7Removes both sides of the specified character trim ($STR,',.?!') LTrim ($STR,',.?!') RTrim ($STR,',.?!')8Finds the position of the specified string in the original string Strpos ($str,'a', $offset), the first position that appears after offset; Stripos ignores case and Stripos as Strrpos ($STR,'a',0); Strripos ($str, $find, $start)9Searches for the position of a string in another string Strstr ($str,'b') = Bcdefgs ... strchr and strstr @[email protected]163. com STRRCHR is a substring that finds the first occurrence on the right163. comTenFind substrings substr substr ($str, $start, $length); If $start <0, starting with the inverse of the string abs ($start), if $length <0, it is intercepted, generally not One fills the string Str_pad ($STR, the target length, the filled string, the fill rule); Str_pad_left left padding, str_pad_right and padding, str_pad_both both sides filled ACompares string strcmp ($a, $b) if $ A is greater than $b, returns 1 if $ A is less than $b, returns-1equals is returned 0 -Replace String Str_replace ('Original String','New String', $STR);  - scrambled A string str_shuffle ($STR) theCut string Str_split ($str, $sub _length) =cut string to get an array, followed by cut length - removal of HTML and PHP markup Strip_tags ($STR, $allow _tags); Removal of $allow_tags except in Str - inverse literal string stripslashes ($STR); - Escape string addslashes ($STR); +Comparing string strnatcmp ($a, $b) using natural sorting algorithms101> OneSo get 1,strcmp ('101',' One'Get1 -Invert string Strrev ($str) + = Get inverse string

String functions commonly used in PHP str

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: 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.