|This article describes common character string processing functions in php5, including string comparison, string search, string truncation, and other functions. For more information, see.
A summary of the php5 string processing functions. you can use php programming for a reference.
Common php string processing functions (string comparison, string search, string truncation, etc.) are as follows: addcslashes-add the backslash escape character addslashes to some characters in the string-escape the characters in the string using the specified method bin2hex-convert the binary data into hexadecimal format to represent the chop-rtrim () the alias function chr-returns a character's ascii code chunk_split-splits the string into small pieces by a certain character length convert_cyr_string-converts the Slavic character to another character convert_uudecode-decrypts a string convert_uencode- encrypt a string count_chars-return the characters in a string using information crc32-calculate the crc32 polynomial of a string crypt-one-way hash encryption function echo-used to display some content explode-use a string the delimiter is converted into an array in the fprintf-the data is returned as required, and directly write the file stream get_html_translation_table-return the converted html entity hebrev-convert the hebrew-encoded string to the visible text hebrevc-convert the hebrew-encoded string to the visible text html_entity_decode-htmlentities () the inverse function of the function, which converts an html object to the character htmlentities-converts some characters in the string to the inverse function of the html object htmlspecialchars_decode-htmlspecialchars () function, convert html entities to characters htmlspecialchars-convert some characters in a string to html entities implode-convert an array to a string join with a specific delimiter-convert an array to a string, implode () function alias levenshtein-calculate the differences between the two words localeconv-get the number-related format definition ltrim-remove the white space on the left side of the string or specify the character md5_file-encrypt a file using the md5 algorithm md5 -encrypt a string using the md5 algorithm metaphone-determine the pronunciation rule of a string money_format-format the number according to the parameter output nl_langinfo-query language and local information nl2br-replace the linefeed in the string" \ n "with"
"Number_format-output ord formatted by parameters-convert an ascii code to a character parse_str-convert a string of a certain format to a variable and a value print-to output a separate value printf-display the data as required quoted_printable_decode-encrypt a string into an 8-bit binary string quotemeta-escape several specific characters rtrim-remove the white space on the right of the string or specify character setlocale-set the number, local format of date and so on-sha1_file-encrypt a file using the sha1 algorithm-encrypt a string using the sha1 algorithm similar_text-compare two strings, returns the number of similar characters that the system considers soundex-determines the pronunciation rules of a string sprintf-returns the data as required, but does not output sscanf- You can format the string str_ireplace-match and replace the string like the str_replace () function, however, it is case-insensitive. str_pad-pad the strings on both sides. str_repeat-repeat the strings. str_replace-match and replace the str_rot13 string. character random sorting str_split-splits a string into an array str_word_count based on the character spacing-obtains the English word information in the string strcasecmp-compares the string size, case-insensitive strchr-returns part of a string through comparison strstr () function alias strcmp-compare the size of a string strcoll-compare the size of a string based on local settings strcspns-returns the value of the consecutive unmatched length of a character stri P_tags-remove the html and php code stripcslashes in a string-reverse the meaning of the character string stripos processed by the addcslashes () function escape-find and return the position of the first matching item, match case-insensitive stripslashes-stristr-returns the part of a string by comparing the character string processed by the reverse-definition addslashes () function escape, comparison is case-insensitive. strlen-obtains the encoding length of a string. strnatcasecmp-compares the size of a string using the natural sorting method, case-insensitive strnatcmp-compare the string size with the natural sorting method strncasecmp-compare the size of the first n characters of the string, case-insensitive strncmp-compare the size of the first n characters of a string strpbrk-returns part of a string through comparison strpos-searches and returns the position of the first matching item strrchr- Returns the part of a string through comparison from the back to the back. strrev-sorts all the letters in the string in reverse order. strripos-searches the back to the back and returns the position of the first matching item, matching case-insensitive strrpos-searches from the back and returns the position of the first matching item strspns-matches and returns the value strstr with consecutive character lengths-returns part of a string through comparison strtok- split string strtolower with specified characters-convert string to lower case strtoupper-convert string to upper case strtr-replace string comparison with substr_compare-comparison after string truncation substr_count- calculate the number of occurrences of a character segment in the string. substr_replace-replace some characters in the string with substr-trash the string with trim-remove the white space on both sides of the string or specify the character ucfirst-Grant the string the Convert a letter to uppercase ucwords-convert the first letter of each English word in the given string to uppercase vfprintf-return the data as required, and directly write the file stream vprintf-display the data as required vsprintf-return the data as required, but do not output wordwrap-split the string strtolower () according to a certain length of characters () the function converts all characters into lowercase letters. the strtoupper () function converts all characters into uppercase letters. the ucfirst () function converts the first letter of the given string into uppercase letters, ucwords () the function converts the first letter of each English word to uppercase. Ucfirst () only processes the first character of a string, ucwords () only processes the first letter of each word (it is determined by space whether it is a word, "today! "Hi" and "today. hi" are considered as a word.) the case sensitivity of other letters does not change. Php example of space-separated text as an array php simple example of splitting Chinese strings into arrays php several methods of separating Chinese and English strings php split () application example of string segmentation function php segmentation GBK Chinese garbled solution php string segmentation function explode example php string comparison and search methods detailed description php comparison of string similarity function usage reference PHP string comparison function strcmp () introduction to strcasecmp () usage example code for comparing string similarity with php