PHP | IntlChar isdefined()函数

这个 IntlChar::isdefined() 函数是PHP中的一个内置函数,用于检查代码点是否已定义。如果为该字符分配了一个字符,则称其为已确定字符。除Cn(其他,未分配)之外的一般类别也是如此。

null

语法:

bool IntlChar::isdefined ( $codepoint )

参数: 此函数只接受一个参数 $codepoint 这是强制性的。这个 $codepoint 值是整数值或字符,编码为 UTF-8 一串

返回值: 如果 $codepoint 是定义的字符,否则为False。

下面的程序说明了 IntlChar::isdefined() PHP中的函数:

项目1:

<?php
// PHP function to illustrate
// the use of IntlChar::isdefined()
// Input data is character type
var_dump(IntlChar::isdefined( "A" ));
// Input data is character type
var_dump(IntlChar::isdefined( " " ));
// Input data is unicode character
var_dump(IntlChar::isdefined( "u{FDD0}" ));
// Input data is string type
var_dump(IntlChar::isdefined( "XYZ" ));
// Input data is character type
var_dump(IntlChar::isdefined( "5" ));
?>


输出:

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

项目2:

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


输出:

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

相关文章:

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

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