ctype_xdigit ( $text );
此函数检查提供的字符串text中的所有字符是否都是十六进制的"xdigit 数字"。
Sr.No | Parameter & Description |
---|---|
1 |
text(必需) 匹配字符串。 |
如果文本中的每个字符都是十六进制数字,即十进制数字或[A-Fa-f]中的字符,则返回TRUE,否则返回FALSE。
链接:https://www.learnfk.comhttps://www.learnfk.com/php/php-function-ctype-xdigit.html
来源:LearnFk无涯教程网
<?php $strings=array('ABCDEF', 'SAI!@#$', 'ab12bc99'); foreach ($strings as $test) { if (ctype_xdigit($test)) { echo "$test consists of all hexadecimal digits.\n"; }else { echo "$test does not have all hexadecimal digits.\n"; } } ?>
这将产生以下输出-
ABCDEF consists of all hexadecimal digits. SAI!@#$does not have all hexadecimal digits. ab12bc99 consists of all hexadecimal digits.
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)