ctype函数_PHP ctype_punct()函数与示例

ctype函数_PHP ctype_punct()函数与示例ctype 函数 PHPctype punct 函数 PHPctype punct function ctype punct functionisac CType functioninPH itisusedtoch php punct

ctype函数

PHP ctype_punct()函数 (PHP ctype_punct() function)

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: "[email protected]!" Output: false  

PHP code:

PHP代码:

<?php $str = "@!~#"; if(ctype_punct($str)) echo ("$str contains all punctuation characters.\n"); else echo ("$str does not contain all punctuation characters.\n"); $str = "@! #~"; //space is there if(ctype_punct($str)) echo ("$str contains all punctuation characters.\n"); else echo ("$str does not contain all punctuation characters.\n"); $str = "[email protected]!"; //alphabets are there if(ctype_punct($str)) echo ("$str contains all punctuation characters.\n"); else echo ("$str does not contain all punctuation characters.\n"); $str = "@!123"; //digits are there if(ctype_punct($str)) echo ("$str contains all punctuation characters.\n"); else echo ("$str does not contain all punctuation characters.\n"); ?>  

Output

输出量

@!~# contains all punctuation characters. @! #~ does not contain all punctuation characters. [email protected]! does not contain all punctuation characters. @!123 does not contain all punctuation characters.  

翻译自: https://www.includehelp.com/php/ctype_punct-function-with-example.aspx

ctype函数

今天的文章 ctype函数_PHP ctype_punct()函数与示例分享到此就结束了,感谢您的阅读。
编程小号
上一篇 2025-01-02 19:21
下一篇 2025-01-02 19:17

相关推荐

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/bian-cheng-ji-chu/99509.html