这个 IntlChar::isblank() 函数是PHP中的一个内置函数,用于确定给定的输入代码数据是空白字符或水平空格字符,可见字符分隔一行中的单词。
null
如果输入包含U+0009(制表符)和字符“Zs”(空格分隔符),零宽度空格(ZWSP,U+200B)除外,则为真。 Unicode空格字符除“垂直空格控制”字符外为真,其中垂直空格控制包含以下字符:U+000A(LF)U+000B(VT)U+000C(FF)U+000D(CR)U+0085(NEL)U+2028(LS)U+2029(PS)。
语法:
bool IntlChar::isblank ( $codepoint )
参数: 此函数接受一个参数,如上所述,如下所述:
- $codepoint: 输入参数$codepoint是一个整数值或字符,它被编码为 UTF-8 一串编译函数后,函数返回一个布尔值。
返回值: 如果$codepoint是空格或水平空格字符,则返回TRUE,否则返回FALSE。
例如:
Input : $codepoint = "G" Output :bool(false) // Character becomes False Input : $codepoint = " " Output : bool(true) // Space becomes TRUE Input : $codepoint = "Geeks" Output : NULL // String becomes NULL
下面的程序说明了 IntlChar::isblank() PHP中的函数:
项目1:
<?php // PHP code to illustrate the // IntlChar::isblank() function. // input alphabe character var_dump(IntlChar::isblank( "X" )); // Plus operator var_dump(IntlChar::isblank( "+" )); // Space character var_dump(IntlChar::isblank( " " )); // % sign operator var_dump(IntlChar::isblank( "%" )); // tab character var_dump(IntlChar::isblank( " " )); // new line character var_dump(IntlChar::isblank( "" )); ?> |
输出:
bool(false) bool(false) bool(true) bool(false) bool(true) bool(false)
项目2:
<?php // PHP code to illustrate the // IntlChar::isblank() function. // input alphabe character var_dump(IntlChar::isblank( 'X' )); // Plus operator var_dump(IntlChar::isblank( '+' )); // Space character var_dump(IntlChar::isblank( ' ' )); // % sign operator var_dump(IntlChar::isblank( '%' )); // tab character var_dump(IntlChar::isblank( ' ' )); // new line character var_dump(IntlChar::isblank( '' )); ?> |
输出:
bool(false) bool(false) bool(true) bool(false) NULL NULL
方案3: 如果函数输入是字符串或数字,那么它将打印NULL。
<?php // PHP code to illustrate the // IntlChar::isblank() function. // In case of input string var_dump(IntlChar::isblank( "GeeksforGeeks is Computer Portal" )); // In case of number input var_dump(IntlChar::isblank( "2018" )); ?> |
输出:
NULL NULL
参考: http://php.net/manual/en/intlchar.isblank.php
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END