Home  >  Article  >  Backend Development  >  The most comprehensive php string processing function

The most comprehensive php string processing function

小云云
小云云Original
2017-11-22 16:45:582441browse

PHP’s string processing function is very powerful. As a PHP programmer, we need to understand what PHP string processing functions are and how to use them. In this article, we will make a general summary of the PHP string processing functions. These are the PHP string processing functions that come with the system.

addcslashes — Add backslash escape characters to some characters in the string
addslashes — Use the specified method to escape the characters in the string
bin2hex — Convert binary data to hexadecimal System representation
chop — Alias ​​function of rtrim()
chr — Returns the ASCII code of a character
chunk_split — Splits a string into small chunks according to a certain character length
convert_cyr_string — Converts Cyrillic characters Convert to other characters
convert_uudecode — Decrypt a string
convert_uuencode — Encrypt a string
count_chars — Return the character usage information in a string
crc32 — Calculate the crc32 polynomial of a string
crypt — One-way hash encryption function
echo — Used to display some content
explode — Convert a string into an array form using a delimiter
fprintf — Return the data as required, and Write directly to the document stream
get_html_translation_table — Returns an HTML entity that can be converted
hebrev — Converts a Hebrew-encoded string to visual text
hebrevc — Converts a Hebrew-encoded string to visual text
html_entity_decode — The inverse function of the htmlentities () function, converts HTML entities into characters
htmlentities — Converts some characters in the string into HTML entities
htmlspecialchars_decode — The inverse function of the htmlspecialchars() function, converts HTML entities Convert to characters
htmlspecialchars — Convert some characters in a string to HTML entities
implode — Convert an array into a string using a specific delimiter
join — Convert an array into a string, implode() function Alias ​​
levenshtein — Calculate the difference between two words
localeconv — Get number-related format definitions
ltrim — Remove the blanks or specified characters on the left side of the string
md5_file — Convert a file MD5 algorithm encryption
md5 — Encrypt a string with MD5 algorithm
metaphone — Determine the pronunciation rules of a string
money_format — Format the output of numbers according to parameters
nl_langinfo — Query language and Local information
nl2br — Replace the newline character "/n" in the string with "
"
number_format — Format the output of a number according to the parameter
ord — Replace an ASCII Convert the code into a character
parse_str — Convert a string in a certain format into a variable and value
print — Used to output a single value
printf — Display the data as required
quoted_printable_decode — Will A string is encrypted into an 8-bit binary string
quotemeta — Escape several specific characters
rtrim — Remove the blanks or specified characters on the right side of the string
setlocale — Set about numbers, Local format of date, etc.
sha1_file — Encrypt a file with SHA1 algorithm
sha1 — Encrypt a string with SHA1 algorithm
similar_text — Compare two strings and return the number of similar characters considered by the system
soundex — Determine the pronunciation rules of a string
sprintf — Return the data as required, but do not output
sscanf — You can format the string
str_ireplace — Like the str_replace() function Match and replace strings, but case-insensitive
str_pad — pad both sides of a string
str_repeat — repeat combinations of strings
str_replace — match and replace strings
str_rot13 — Encrypt the string with ROT13
str_shuffle — Randomly sort the characters in a string
str_split — Split a string into an array according to the character spacing
str_word_count — Get the English words in the string Info
strcasecmp — Compares strings by size, case-insensitive
strchr — Alias ​​for the strstr() function that returns part of a string by comparison
strcmp — Compares strings by size
strcoll – Compare the size of strings according to local settings
strcspn – Return the value of the consecutive non-matching length of characters
strip_tags – Remove HTML and PHP code in a string
stripcslashes – Unescap addcslashes() Function escapes the processed string
stripos — Finds and returns the position of the first match, matching is case-insensitive
stripslashes — Unescapes the addslashes() function escapes the processed string
stristr — Returns parts of a string by comparison, case-insensitive
strlen — Gets the encoded length of a string
strnatcasecmp — Compares strings using natural ordering, case-insensitive
strnatcmp — Compare the size of strings using natural sorting
strncasecmp — Compare the size of the first N characters of a string, case-insensitive
strncmp — Compare the size of the first N characters of a string Compare
strpbrk — Returns a portion of a string by comparing it
strpos — Finds and returns the position of the first match
strrchr — Returns a portion of a string by comparing it backwards
strrev — Arrange all letters in the string in reverse order
strripos — Search from back to front and return the position of the first match, matching is not case-sensitive
strrpos - Search backwards and return the position of the first match
strspn - Match and return the value of the length of consecutive occurrences of characters
strstr - Return a portion of a string by comparison
strtok - Use the specified Several characters to split the string
strtolower - Convert the string to lowercase
strtoupper - Convert the string to uppercase
strtr - Compare and replace the string
substr_compare - After intercepting the string Comparison
substr_count — Count the number of occurrences of a certain character segment in a string
substr_replace — Replace some characters in the string
substr — Truncate the string
trim — Remove both sides of the string Blanks or specified characters
ucfirst — Convert the first letter of the given string to uppercase
ucwords — Convert the first letter of each English word in the given string to uppercase
vfprintf — Returns data as required and writes directly into the document stream
vprintf — Displays data as required
vsprintf — Returns data as required, but does not output
wordwrap — According to certain characters Length split string

The above is a summary of PHP string processing functions, I hope it will be helpful to everyone.

Related recommendations:

Several forgotten PHP string processing functions

About PHP’s built-in strings Detailed explanation of processing functions

Commonly used string processing functions in php

The above is the detailed content of The most comprehensive php string processing function. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn