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:

  • $codepoint: The input parameter $codepoint is an integer values or character, which is encoded as a UTF-8 string. The function returns a boolean value after the compilation of function.

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:

filter_none

edit
close

play_arrow

link
brightness_4
code

<?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("\t"));
  
// new line character
var_dump(IntlChar::isblank("\n"));
?>

chevron_right


Output:

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

Program 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

<?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('\t'));
  
// new line character
var_dump(IntlChar::isblank('\n'));
?>

chevron_right


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.

filter_none

edit
close

play_arrow

link
brightness_4
code

<?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"));
?>

chevron_right


Output:

NULL
NULL

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



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



Improved By : Akanksha_Rai



Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.