Related Articles

Related Articles

PHP | IntlChar::isUWhiteSpace() Function
  • Last Updated : 27 Aug, 2019

The IntlChar::isUWhiteSpace() function is an inbuilt function in PHP which is used to check whether the given input character is a WhiteSpace Unicode character or not. IntlChar accesses a number utility function and used to access the information about Unicode Characters.

Syntax:

bool IntlChar::isUWhiteSpace( $codepoint )

Parameters: This function accepts a single parameter $codepoint which is mandotary. The input parameter is a character or integer value, which is encoded as a UTF-8 string.

Return Value: If $codepoint is WhiteSpace character then returns True, otherwise return False.

Below programs illustrate the IntlChar::isUWhiteSpace() Function in PHP.



Program 1:

filter_none

edit
close

play_arrow

link
brightness_4
code

<?php
// PHP code to illustrate IntlChar::isUWhiteSpace()
// function
  
// Input Capital Letter
var_dump(IntlChar::isUWhiteSpace("N"));
  
// Input Small Letter
var_dump(IntlChar::isUWhiteSpace(" n "));
  
// Input Whitesapce Character  "\n "
var_dump(IntlChar::isUWhiteSpace("\n"));
  
// Input encoded string 
var_dump(IntlChar::isUWhiteSpace("\u{00B0}"));
?>

chevron_right


Output:

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

Program 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

<?php
// PHP code to IntlChar::isUWhiteSpace()
// function
  
// Declare an array $arr
$arr = array("X\t", "\n", "^", "\r", "\t\r");
  
// Loop run for every array element
foreach ($arr as $val){
      
    // Check each element as code point data
    var_dump(IntlChar::isUWhiteSpace($val));
}
?>

chevron_right


Output:

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

Related Articles:

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




My Personal Notes arrow_drop_up
Recommended Articles
Page :