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

ctype函数

PHP ctype_xdigit()函数 (PHP ctype_xdigit() function)

ctype_xdigit() function is a character type (CType) function in PHP, it is used to check whether a given string contains hexadecimal digits or not.

ctype_xdigit()函数是PHP中的字符类型(CType)函数,用于检查给定的字符串是否包含十六进制数字。

It returns true, if all characters of the given strings are hexadecimal digits – which are 0,1,2,3,4,5,6,7,8,9,0,A,B,C,D,E,F,a,b,c,d,e,f. Else it returns false.

如果给定字符串的所有字符均为十六进制数字(即0、1、2、3、4、5、6、7、8、9、0,A,B,C,D,E,F) ,则返回true ,a,b,c,d,e,f 。 否则返回false 。

Syntax:

句法:

    ctype_xdigit(string) : bool

Example:

例:

    Input: "ABCD1209"
Output: true
Input: "9009aaff"
Output: true
Input: "1234"
Output: true
Input: "123G4"
Output: false

PHP code:

PHP代码:

<?php
$str = "ABCD1209";
if(ctype_xdigit($str))
echo ("$str contains all hexadecimal digits.\n");
else
echo ("$str does not contain all hexadecimal digits.\n");
$str = "9009aaff";
if(ctype_xdigit($str))
echo ("$str contains all hexadecimal digits.\n");
else
echo ("$str does not contain all hexadecimal digits.\n");
$str = "1234";
if(ctype_xdigit($str))
echo ("$str contains all hexadecimal digits.\n");
else
echo ("$str does not contain all hexadecimal digits.\n");
$str = "123G4"; //Here, "G" is not an hexadecimal digit
if(ctype_xdigit($str))
echo ("$str contains all hexadecimal digits.\n");
else
echo ("$str does not contain all hexadecimal digits.\n");	
?>

Output

输出量

ABCD1209 contains all hexadecimal digits.
9009aaff contains all hexadecimal digits.
1234 contains all hexadecimal digits.
123G4 does not contain all hexadecimal digits.

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

ctype函数

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/541295.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

linux ldd运行不成功,Linux_Linux:Ldd命令介绍及使用方法,1、首先ldd不是一个可执行程序 - phpStudy...

Linux&#xff1a;Ldd命令介绍及使用方法1、首先ldd不是一个可执行程序&#xff0c;而只是一个shell脚本2、ldd能够显示可执行模块的dependency&#xff0c;其原理是通过设置一系列的环境变量&#xff0c;如下&#xff1a;LD_TRACE_LOADED_OBJECTS、LD_WARN、LD_BIND_NOW、LD_L…

开发原生的 Google 眼镜应用 【已翻译100%】(2/2)

使用传感器 Glass没有键盘或触摸屏&#xff0c;但仍然具有移动设备所有的标准的传感器。你可以使用标准的传感器组件来访问这些传感器。 定位和GPS Glass内置有GPS。TLocationSensor具有一个OnLocationChanged事件&#xff0c;这一事件在GPS组件被激活时产生&#xff0c;在有除…

linux下php的安装,Linux下PHP安装

1 下载php源码安装包 个人是php-5.6.30.tar.gzphp2 解压文件mysqltar -zxvf php-5.6.30.tar.gznginx3 编译安装sqlcd php-5.6.30api建立www用户和www用户组curlgroupadd wwwsocketuseradd -g www wwwphp-fpm在编译以前先把依赖包都装上urlyum install curl curl-develyum inst…

PHP array_filter()函数与示例

PHP array_filter()函数 (PHP array_filter() Function) array_filter() function is used to apply a filter on array elements based on the function and returns the array with filtered elements, it accepts an array to be checked and a callback function. The call…

微软宣布以 262 亿美元现金收购 LinkedIn

北京时间6月13日20:45&#xff08;美国当地时间6月13日上午8:45&#xff09;&#xff0c;微软(Nasdaq: MSFT)和LinkedIn(领英&#xff0c;NYSE: LNKD)对外宣布&#xff0c;双方达成协议&#xff0c;微软宣布将以每股196美元、总价262亿美元的价格收购LinkedIn&#xff0c;由现金…

linux vim 快速定位位置,vim快速移动定位的一些操作命令

很多时候你在编辑文件时移动光标都会花很长时间&#xff0c;这样就无法高效的编辑了&#xff0c;要想达到高效编辑最好能够将光标马上定位到你需要的位置&#xff0c;vim就是可以满足你这样需求的一款编辑器&#xff0c;本节就要讲一下vim快速移动定位的一些操作命令。下面的操…

本月初 本月末 java_本月内容作家(2018年8月)

本月初 本月末 javaWe are feeling glad to announce that Prerana Jain is the Content Writer Of The Month (August 2018) on the basis of her excellent contribution and her support to us. 我们很高兴地宣布&#xff0c; Prera​​na Jain凭借其出色的贡献和对我们的支…

“玲珑杯”线上赛 Round #15 河南专场 F 咸鱼文章

elttiL moT nwod eht teerts sllac ruo god ” ehT peek god ” . piZ si a peehs god . tuB nehw moT seirt ot yas ” peeS ” , ti semoc tuo ” peek ” . dnA ni a yaw moT si thgir . piZ si syawla gnignirb sgniht oh rof su ot peek ! ll’I llet uoy tuoba emos fo m…

线性代数向量内积_向量的外积| 使用Python的线性代数

线性代数向量内积Prerequisites: 先决条件&#xff1a; Defining Vector using Numpy 使用Numpy定义向量 Learn: how to code for outer product of two vectors using am inbuilt function in numpy library? 了解&#xff1a;如何使用numpy库中的内置函数为两个向量的外部乘…

c语言案例朗读工具源码,C语言编写简单朗读小工具(有源码)

原标题&#xff1a;C语言编写简单朗读小工具(有源码)最近不少人在后台留言说学C都是面对枯燥的控制台程序&#xff0c;能不能体现一下C语言的实际用途&#xff0c;今天我们就理论结合实践一把&#xff1a;C语言结合VBS脚本编写一个简单的朗读小工具&#xff0c;做一个能够发音的…

WAS集群系列(5):集群搭建:步骤3:安装IHS软件

选择“安装IBM HTTPServer”选项&#xff0c;点击“安装向导”。例如以下图提示&#xff1a; 安装提示&#xff0c;逐步点击“下一步”&#xff0c;当中偶有几处细节注意就可以。列举例如以下&#xff1a; &#xff08;1&#xff09;、产品安装路径与先前WAS软件所安装路径统一…

L1-056 猜数字 C语言,PAT L1-032 Left-pad

根据新浪微博上的消息&#xff0c;有一位开发者不满NPM(Node Package Manager)的做法&#xff0c;收回了自己的开源代码&#xff0c;其中包括一个叫left-pad的模块&#xff0c;就是这个模块把javascript里面的React/Babel干瘫痪了。这是个什么样的模块&#xff1f;就是在字符串…

单链表删除整表_单链表删除

单链表删除整表Deletion can be at various positions like: 删除可以在各个位置进行&#xff0c;例如&#xff1a; Deleting the first node 删除第一个节点 Deleting the last node 删除最后一个节点 Deleting the intermediate node 删除中间节点 删除单个链表中的第一个节…

WordPress数据表wp-options数据字段存JSON数据

2019独角兽企业重金招聘Python工程师标准>>> wp_options表是WordPress中最重要的表&#xff0c;一切程序设置、主题设置和绝大多数插件的设置大都保存在此表。 WordPress里面数据表wp-options数据字段存JSON数据 &#xff1a; a:90: {s:11:"^wp-json/?$"…

css scroll属性_CSS中的scroll-behavior属性

css scroll属性CSS | 滚动行为属性 (CSS | scroll-behavior property) Who does not want their links to function smoothly and attractively? This type of functionality is very easy to implement. All you need is a bit of awareness about the property that would h…

c 语言五子棋游戏代码,C语言案例:控制台版本的五子棋游戏【代码】

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼return true;}x;}return false;}bool isLeftInclinedWin(bool isBlack,int x,int y){char c isBlack ? :O;int count;while(x>0 && y>0 && state[x][y] c){y--;x--;}count 0;if(state[x][y] c) count 1…

基于HTML5 Canvas 实现弹出框

用户鼠标移入时&#xff0c;有弹出框出现&#xff0c;这样的需求很常见。这在处理HTML元素实现时简单&#xff0c;但是如果是对 HTML5 Canvas 构成的图形进行处理&#xff0c;这种方法不再适用&#xff0c;因为 Canvas 使用的是另外一套机制&#xff0c;无论在 Canvas 上绘制多…

半素数c语言,非常简单的c题目 不懂 紧急求助

1 半素数素数是指大于1且只有1和他本身两个因子的正整数&#xff0c;例如2、3、5、89都是素数&#xff0c;2、4、10都不是素数。在这里我给半素数下一个定义&#xff1a;一个大于1的正整数能分解为两个素数的乘积&#xff0c;那么这个正整数就是半素数&#xff0c;比如62*3&am…

JavaScript | 嵌套if的示例

Example: 例&#xff1a; In this example, we are reading salary of an employee and finding the discount and net pay based on given salary and discount rate. 在此示例中&#xff0c;我们正在读取员工的薪水&#xff0c;并根据给定的薪水和折扣率找到折扣和净工资。 …

POJ 1014 Dividing 背包

二进制优化&#xff0c;事实上是物体的分解问题。 就是比方一个物体有数量限制&#xff0c;比方是13&#xff0c;那么就须要把这个物体分解为1。 2&#xff0c; 4&#xff0c; 6 假设这个物体有数量为25&#xff0c;那么就分解为1&#xff0c; 2&#xff0c; 4。 8。 10 看出规…