本文共 846 字,大约阅读时间需要 2 分钟。
ctype函数
ctype_punct() function is a character type (CType) function in PHP, it is used to check whether a given string contains all punctuation characters (can be considered as special characters) or not.
ctype_punct()函数是PHP中的字符类型(CType)函数,用于检查给定的字符串是否包含所有标点字符(可以视为特殊字符)。
It returns true, if all characters of the given strings are punctuation characters, else it returns false.
它返回true,如果给定字符串的所有字符是标点字符,否则返回FALSE。
Syntax:
句法:
ctype_punct(string) : bool
Example:
例:
Input: "@!~#" Output: true Input: "@! #~" Output: false Input: "!" Output: false
PHP code:
PHP代码:
Output
输出量
@!~# contains all punctuation characters.@! #~ does not contain all punctuation characters.! does not contain all punctuation characters.@!123 does not contain all punctuation characters.
翻译自:
ctype函数
转载地址:http://nzozd.baihongyu.com/