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.pswp.cn/news/541295.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/541295.shtml
英文地址,請注明出處:http://en.pswp.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 看出規…