PHP5 String Processing Function Summary

Source: Internet
Author: User
Tags array example crc32 format definition rtrim sha1
This article describes the usual string processing functions in php5, including string comparisons, string lookups, string truncation, and other functions that are needed by the friend reference.

PHP5 string processing function Summary, the use of PHP programming friends can make a reference.

PHP commonly used string processing functions (string comparison, string lookup, string interception, etc.), as follows: Addcslashes-adds a backslash escape character to a partial character inside a string addslashes-the characters inside the string are escaped in the specified manner bin2hex- Converts binary data to a hexadecimal representation of the Chop-rtrim () alias function chr-returns the ASCII code for a character chunk_split-splits the string into small pieces at a certain length convert_cyr_string-converts Slavic characters to other The character convert_uudecode-decrypts a string convert_uuencode-encrypts a string count_chars-returns a string inside the character using information crc32-computes a string of CRC32 polynomial crypt-single The hash encryption function echo-is used to display some content explode-converts a string into an array form with a delimiter fprintf-returns the data as required and writes directly to the document stream get_html_translation_table-returns the HT that can be converted ML entity hebrev-converts a Hebrew encoded string into a visual text hebrevc-converts a Hebrew encoded string into a visual text html_entity_decode-htmlentities () function's inverse function, Converts an HTML entity to a character htmlentities-converts some characters in a string to an inverse function of an HTML entity Htmlspecialchars_decode-htmlspecialchars () function, converting an HTML entity to a character Htmlspecialchars-converts some characters in a string to an HTML entity implode-converts an array to a string with a specific delimiter join-converts an array to a string, and the implode () function alias levenshtein-calculates the difference size of two words localeconv-get a number-related format definition ltrim-remove whitespace to the left of a string or specify a character md5_file-a file for MD5 algorithm encryption md5-a string MD5 algorithm encryption metaphone-determine the pronunciation of a string Rule money_format-The output nl_langinfo-the query language and the localInformation nl2br-Replace the newline character "\ n" in the string with "
number_format-the output of a number formatted according to parameters ord-converts an ASCII code to a character parse_str-convert a certain format string to a variable and a value print-to output a separate value printf-the data in accordance with the requirements Line display quoted_printable_decode-encrypts a string into a 8-bit binary string quotemeta-to escape several specific characters rtrim-remove whitespace to the right of the string or specify the character setlocale-set about the number, day The local format sha1_file-a file for SHA1 algorithm encryption sha1-a string to SHA1 algorithm encryption similar_text-compare two strings, return the system to think of the number of similar characters soundex-judge a string pronunciation rule s printf-returns the data as required, but does not output sscanf-can format the string str_ireplace-like the Str_replace () function to match and replace strings, but case-insensitive str_pad-padding on both sides of the string tr_repeat-repeating strings str_replace-matching and replacing strings str_rot13-string for rot13 cryptographic processing str_shuffle-randomly sort characters inside a string str_split-a word String is divided into an array by the character spacing str_word_count-gets the English word information inside the string strcasecmp-the string size comparison, case-insensitive strchr-by comparing the portion of a string that returns the alias of the Strstr () function strcmp-the size comparison of a string strcoll– the string size comparison based on local settings strcspn-returns the value of a continuous non-matching length of characters strip_tags-remove HTML and PHP code inside a string stripcslashes-anti- The Escape addcslashes () function escapes the processed string stripos-finds and returns the position of the first occurrence, matching the case-insensitive stripslashes-inverse addslashes () function to escape the processed string stristr- Returns a portion of a string by comparison, when the comparison is case-insensitive strlen-gets a characterString encoding length strnatcasecmp-use natural sorting to compare the size of strings, case-insensitive strnatcmp-use natural sorting to compare the size of a string strncasecmp-the first n characters of a string, case-insensitive strncmp-size comparison of the first n characters of a string strpbrk-returns a portion of a string by comparison strpos-finds and returns the position of the first occurrence strrchr-by comparing the parts of a string from backward to forward strrev-the string inside all The letter strripos-the position of the first match from the back to the next, matches the case-insensitive strrpos– the position of the first occurrence from the back, strspn-matches and returns the value of the character's contiguous length strstr-by comparing the part that returns a string strtok-splits a string with a specified number of characters strtolower-converts the string to lowercase strtoupper– converts the string to uppercase strtr-the comparison to the string compare substr_compare-to the string after the Intercept subst R_count-computes the number of occurrences of a character segment in a string substr_replace-replaces a portion of a character in a string substr-a string to be truncated trim-remove whitespace on either side of the string or specify the character ucfirst-the first word of the given string Convert the mother to uppercase ucwords-the first letter of each English word of the given string into uppercase vfprintf-returns the data as required and writes directly to the document stream vprintf-the data is displayed as required vsprintf-the data is returned as required, but does not Output wordwrap-the string Strtolower () function to divide all characters into lowercase by a certain character length, the Strtoupper () function capitalizes all characters, and the Ucfirst () function converts the first letter of the given string to uppercase, Ucwords ( function to capitalize the first letter of each English word of the given string. Ucfirst () only handles the first character of the string, Ucwords () handles only the first letter of each word (with a space to define whether it is a word, "Today!hi", "Today.hi" is considered a word), and the case state of the remaining letters does not change. PHP space Split text Array example PHP split Chinese string arrayA simple example of PHP split in English strings in several ways PHP split () String segmentation function Application Example PHP segmentation gbk Chinese garbled solution PHP string segmentation function Explode example PHP string comparison and lookup method the PHP comparison string similarity function usage reference PHP string comparison function strcmp () and strcasecmp The usage of () introduces the example code of PHP comparing string similarity

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