Open In App

PHP | IntlChar::isblank() Function

The IntlChar::isblank() function is an inbuilt function in PHP which is used to determine the given input code data is blank or horizontal space character and the character visible separates words on a line. 

If the input contains U+0009 (TAB) and characters “Zs” (space separators) except Zero Width Space (ZWSP, U+200B) then it will be True. 



A Unicode White_Space character except “vertical space controls” character is true where vertical space controls contain following characters: U+000A (LF) U+000B (VT) U+000C (FF) U+000D (CR) U+0085 (NEL) U+2028 (LS) U+2029 (PS). 

Syntax:



bool IntlChar::isblank ( $codepoint )

Parameter: This function accepts a single parameter as mentioned above and described below:

Return Value: If $codepoint is a blank space or horizontal space character then returns TRUE, otherwise returns FALSE. Examples:

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

Below programs illustrate the IntlChar::isblank() function in PHP: 

Program 1: 




<?php
// PHP code to illustrate the
// IntlChar::isblank() function.
 
// input alphabet 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("\t"));
 
// new line character
var_dump(IntlChar::isblank("\n"));
?>

Output:

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

Program 2: 




<?php
// PHP code to illustrate the
// IntlChar::isblank() function.
 
// input alphabet 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('\t'));
 
// new line character
var_dump(IntlChar::isblank('\n'));
?>

Output:

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

Program 3: If function input is string or number, then it will print 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"));
?>

Output:

NULL
NULL

Reference: http://php.net/manual/en/intlchar.isblank.php


Article Tags :