Commonly used string functions in PHP

Source: Internet
Author: User

Addslashes--use a backslash to reference a string

CHR-Returns a single character that is specified relative to the ASCII code value.

Chunk_split--Splitting a string into small chunks

Count_chars--information about the characters used to return a string

CRC32--computes the crc32 polynomial of a string

crypt– to encrypt strings with DES encoding

echo– output one or more strings

Explode--splitting another string with one string

sprintf– format a string and output

html_entity_decode– Convert all HTML entities to their corresponding characters

htmlentities– convert all characters to HTML entities

Htmlspecialchars_decode-Converts a specific HTML entity to the corresponding character

Htmlspecialchars-Converts a specific character into an HTML entity

implode– concatenate all elements of an array into a single string

Alias of Join--implode () function

LTrim--Remove the whitespace (or other characters) to the left of a string

md5_file– get MD5 summary of files

MD5--Get a MD5 summary of the string

money_format– to format a number in the format of a currency

NL2BR--Inserts an HTML wrap tag in a string.

Number_format--format a number with grouped thousands

ord– returns the ASCII value of a character

Parse_str--Parsing string variables

print– output A string

printf– format and output the string

RTrim--Remove the whitespace (or other characters) to the right of a string

sha1_file– encode a file with SHA1 (encrypted)

SHA1--encode a string with SHA1 (encrypt)

Similar_text-Calculates the similarity between two strings

sprintf– returns a formatted string

Str_ireplace--Str_replace () ignores case versions.

Str_pad--Padding string

Str_repeat--repeating string

str_replace– replacing the specified string

str_shuffle– Random string content

Str_split--Converts a string into an array

Str_word_count--Returns the number of words in a string

strcasecmp– Case Insensitive string comparison

STRCHR--alias of Strstr ()

strcmp– string comparison (binary string comparison)

strip_tags– to remove HTML and PHP tags from a string

Stripos-the position of the first occurrence of a case-insensitive lookup character (or string) in a string

Stripslashes-Removes backslashes added using the function addslashes ().

STRISTR--Case insensitive strstr ()

strlen– gets the length of the string

STRNATCASECMP--Case insensitive string comparisons, using natural sorting algorithms

STRNATCMP--Comparison of strings, using natural sorting algorithm

Strpos--Finds the position where a character first appears in a string.

strrchr– returns a substring that begins at the last occurrence of a character until the end of the string.

strrev– to invert the string output

Strripos-Returns the position of the last occurrence of a character in the string (case insensitive).

Strrpos-Returns the position of the last occurrence of a character in the string (case-sensitive).

strstr– returns a substring (containing the character) that begins at the first occurrence of a character until the end of the string.

strtolower– converts all characters of a string to lowercase

strtoupper– converts all characters of a string to uppercase

substr_count– count occurrences of substrings (case-sensitive)

substr_replace– string substitution

substr– returns a string at the specified position

trim– remove whitespace (or other characters) of the left and right sides of the string

ucfirst– to capitalize the first character of a string

Ucwords-Capitalize the first letter of each word of a string

Commonly used string functions in PHP

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.