日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程语言 > php >内容正文

php

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

發(fā)布時間:2025/3/11 php 42 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ctype函数_PHP ctype_xdigit()函数与示例 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

ctype函數(shù)

PHP ctype_xdigit()函數(shù) (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()函數(shù)是PHP中的字符類型(CType)函數(shù),用于檢查給定的字符串是否包含十六進制數(shù)字。

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.

如果給定字符串的所有字符均為十六進制數(shù)字(即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: trueInput: "9009aaff"Output: trueInput: "1234"Output: trueInput: "123G4"Output: false

PHP code:

PHP代碼:

<?php$str = "ABCD1209";if(ctype_xdigit($str))echo ("$str contains all hexadecimal digits.\n");elseecho ("$str does not contain all hexadecimal digits.\n");$str = "9009aaff";if(ctype_xdigit($str))echo ("$str contains all hexadecimal digits.\n");elseecho ("$str does not contain all hexadecimal digits.\n");$str = "1234";if(ctype_xdigit($str))echo ("$str contains all hexadecimal digits.\n");elseecho ("$str does not contain all hexadecimal digits.\n");$str = "123G4"; //Here, "G" is not an hexadecimal digitif(ctype_xdigit($str))echo ("$str contains all hexadecimal digits.\n");elseecho ("$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函數(shù)

總結(jié)

以上是生活随笔為你收集整理的ctype函数_PHP ctype_xdigit()函数与示例的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。