CLXI. String 字符串处理函数
简介
本类函数用来对字符串进行各种操作。对字符串的一些其它专门操作,可以参考手册的正则表达式部分和 URL 操作部分。
如果想要了解字符串的相关内容,特别是有关单引号,双引号等的处理部分,可以参考手册中类型部分中的字符串条目。
需求
要编译本扩展模块无需外部库文件。
安装
本扩展模块作为 PHP 内核的一部分,无需安装即可使用。
预定义常量
以下常量由本扩展模块定义,因此只有在本扩展模块被编译到 PHP 中,或者在运行时被动态加载后才有效。
- CRYPT_SALT_LENGTH integer
- CRYPT_STD_DES integer
- CRYPT_EXT_DES integer
- CRYPT_MD5 integer
- CRYPT_BLOWFISH integer
- HTML_SPECIALCHARS (integer)
- HTML_ENTITIES (integer)
- ENT_COMPAT (integer)
- ENT_QUOTES (integer)
- ENT_NOQUOTES (integer)
- CHAR_MAX (integer)
- LC_CTYPE (integer)
- LC_NUMERIC (integer)
- LC_TIME (integer)
- LC_COLLATE (integer)
- LC_MONETARY (integer)
- LC_ALL (integer)
- LC_MESSAGES (integer)
- STR_PAD_LEFT (integer)
- STR_PAD_RIGHT (integer)
- STR_PAD_BOTH (integer)
参见
如果想更深入的了解有关字符串高级操作的相关内容,请参阅手册的 POSIX 扩展正则表达式函数和 Perl 兼容正则表达式函数部分。
目录
- addcslashes 以 C 语言风格使用反斜线转义字符串中的字符
- addslashes 使用反斜线引用字符串
- bin2hex 将二进制数据转换成十六进制表示
- chop rtrim() 的别名
- chr 返回指定的字符
- chunk_split 将字符串分割成小块
- convert_cyr_string 将字符由一种 Cyrillic 字符转换成另一种
- convert_uudecode Decode a uuencoded string
- convert_uuencode Uuencode a string
- count_chars 返回字符串所用字符的信息
- crc32 计算一个字符串的 crc32 多项式
- crypt One-way string encryption (hashing)
- echo Output one or more strings
- explode 使用一个字符串分割另一个字符串
- fprintf Write a formatted string to a stream
- get_html_translation_table Returns the translation table used by htmlspecialchars() and htmlentities()
- hebrev Convert logical Hebrew text to visual text
- hebrevc Convert logical Hebrew text to visual text with newline conversion
- html_entity_decode Convert all HTML entities to their applicable characters
- htmlentities Convert all applicable characters to HTML entities
- htmlspecialchars_decode Convert special HTML entities back to characters
- htmlspecialchars Convert special characters to HTML entities
- implode Join array elements with a string
- join 别名 implode()
- levenshtein Calculate Levenshtein distance between two strings
- localeconv Get numeric formatting information
- ltrim Strip whitespace (or other characters) from the beginning of a string
- md5_file Calculates the md5 hash of a given file
- md5 Calculate the md5 hash of a string
- metaphone Calculate the metaphone key of a string
- money_format Formats a number as a currency string
- nl_langinfo Query language and locale information
- nl2br Inserts HTML line breaks before all newlines in a string
- number_format Format a number with grouped thousands
- ord Return ASCII value of character
- parse_str Parses the string into variables
- print Output a string
- printf Output a formatted string
- quoted_printable_decode Convert a quoted-printable string to an 8 bit string
- quotemeta Quote meta characters
- rtrim Strip whitespace (or other characters) from the end of a string
- setlocale Set locale information
- sha1_file Calculate the sha1 hash of a file
- sha1 Calculate the sha1 hash of a string
- similar_text Calculate the similarity between two strings
- soundex Calculate the soundex key of a string
- sprintf Return a formatted string
- sscanf Parses input from a string according to a format
- str_getcsv Parse a CSV string into an array
- str_ireplace Case-insensitive version of str_replace().
- str_pad Pad a string to a certain length with another string
- str_repeat Repeat a string
- str_replace Replace all occurrences of the search string with the replacement string
- str_rot13 Perform the rot13 transform on a string
- str_shuffle Randomly shuffles a string
- str_split Convert a string to an array
- str_word_count Return information about words used in a string
- strcasecmp Binary safe case-insensitive string comparison
- strchr 别名 strstr()
- strcmp Binary safe string comparison
- strcoll Locale based string comparison
- strcspn Find length of initial segment not matching mask
- strip_tags Strip HTML and PHP tags from a string
- stripcslashes Un-quote string quoted with addcslashes()
- stripos Find position of first occurrence of a case-insensitive string
- stripslashes Un-quote string quoted with addslashes()
- stristr Case-insensitive strstr()
- strlen Get string length
- strnatcasecmp Case insensitive string comparisons using a "natural order" algorithm
- strnatcmp String comparisons using a "natural order" algorithm
- strncasecmp Binary safe case-insensitive string comparison of the first n characters
- strncmp Binary safe string comparison of the first n characters
- strpbrk Search a string for any of a set of characters
- strpos Find position of first occurrence of a string
- strrchr Find the last occurrence of a character in a string
- strrev Reverse a string
- strripos Find position of last occurrence of a case-insensitive string in a string
- strrpos Find position of last occurrence of a char in a string
- strspn Find length of initial segment matching mask
- strstr Find first occurrence of a string
- strtok Tokenize string
- strtolower Make a string lowercase
- strtoupper Make a string uppercase
- strtr Translate certain characters
- substr_compare Binary safe optionally case insensitive comparison of 2 strings from an offset, up to length characters
- substr_count Count the number of substring occurrences
- substr_replace Replace text within a portion of a string
- substr Return part of a string
- trim Strip whitespace (or other characters) from the beginning and end of a string
- ucfirst Make a string's first character uppercase
- ucwords Uppercase the first character of each word in a string
- vfprintf Write a formatted string to a stream
- vprintf Output a formatted string
- vsprintf Return a formatted string
- wordwrap Wraps a string to a given number of characters using a string break character
add a note
User Contributed NotesString 字符串处理函数
There are no user contributed notes for this page.

stream_wrapper_unregister