欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

從C/C++遷移到PHP——判斷字符類型的函數(shù)

 更新時間:2006年10月09日 00:00:00   作者:  

  在C/C++中,頭文件ctype.h中定義了關(guān)于字符類型一組宏,可以得到給定字符的類型。
而PHP中沒有相關(guān)函數(shù)。前些天發(fā)現(xiàn)在www.mm4.de下載的PHP中提供了一個名為php_ctype.dll的擴展庫,
加載后發(fā)現(xiàn)提供一部分此類的函數(shù),特整理出來供大家參考。
  在PHP中正確加載php_ctype.dll文件后,用<?php phpinfo();?>可以看到以下信息:
      ctype
  ctype functions enabled (experimental)
然后就可以使用它所提供的函數(shù)了。所有函數(shù)的用法同C/C++基本相同,區(qū)別在于在C/C++中函數(shù)的參數(shù)是
字符型(char),而在PHP中函數(shù)的參數(shù)可以是字符串(string)。例如:

<?php
$string="123ADAADAD";
if(isalnum($string))
{
echo "只有大小寫字母和數(shù)字!";
}

?>

附:php_ctype.dll支持的函數(shù)
bool isalnum(string)
bool isalpha(string)
bool iscntrl(string)
bool isdigit(string)
bool isgraph(string)
bool islower(string)
bool isprint(string)
bool ispunct(string)
bool isspace(string)
bool isupper(string)
bool isxdigit(string)

【本文版權(quán)歸作者凡草0515與奧索網(wǎng)共同擁有,如需轉(zhuǎn)載,請注明作者及出處】     

相關(guān)文章

最新評論