PHP | IntlChar::isbase()函数

这个 IntlChar::isbase() 函数是PHP中的一个内置函数,用于检查给定的输入数据是否为基字符。如果指定的代码点是基字符,则对于一般类别“L”(字母)、“N”(数字)、“Mc”(间距组合标记)和“Me”(封闭标记),它将返回TRUE。 语法:

null
bool IntlChar::isbase( $codepoint )

参数: 此函数只接受一个参数 $codepoint 这是强制性的。输入参数是一个整数或字符,编码为 UTF-8 一串 返回值: 如果$codepoint是基本字符,则返回TRUE,否则返回FALSE。 例如:

Input :(IntlChar::isbase("D"))Output : bool(true)Input : (IntlChar::isbase("*"))Output : bool(false)Input :(IntlChar::isbase("9"));Output :bool(true)

下面的程序说明了 IntlChar::isbase() PHP中的函数: 项目1:

php

<?php
// PHP code to illustrate IntlChar::isbase()
// Function
// Input data is character type
var_dump(IntlChar::isbase( "D" ));
// Input data is string type
var_dump(IntlChar::isbase( "Geeksforgeeks" ));
// Input data is integer type
var_dump(IntlChar::isbase( "234" ));
// Input data is special character type
var_dump(IntlChar::isbase( "*" ));
?>


输出:

bool(true) NULL NULL bool(false) 

项目2:

php

<?php
//PHP code to illustrate IntlChar::isbase()()
// Declare an array $arr
$arr = array ( "4" , "20001111" , "^" , "  " , "*" , "GeeksforGeeks" );
// Loop run for every array element
foreach ( $arr as $val ){
// Check each element as code point data
var_dump(IntlChar::isbase( $val ));
}
?>


输出:

bool(true) NULL bool(false) NULL bool(false) NULL 

相关文章:

参考: http://php.net/manual/en/intlchar.isbase.php

© 版权声明
THE END
喜欢就支持一下吧
点赞8 分享