Tutorialspoint.dev

PHP | IntlChar::isJavaSpaceChar() Function

The IntlChar::isJavaSpaceChar() function is an inbuilt function in PHP which is used to check whether the input character code point is a space character or not according to Java. Its value is True for characters with general category “Z” (Separators), which does not include control character.

Syntax:

bool IntlChar::isJavaSpaceChar( $codepoint )

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

Return Value: Returns True, if $codepoint is space character according to java, otherwise return False.

Below programs illustrate the IntlChar::isJavaSpaceChar() Function in PHP:



Program 1:

<?php
// PHP function to illustrate the
// use of IntlChar::isJavaSpaceChar()
  
// Input control character codepoint value 
var_dump(IntlChar::isJavaSpaceChar(" "));
echo "<br>";
  
// Input control character codepoint value 
var_dump(IntlChar::isJavaSpaceChar(" "));
echo "<br>";
  
// Input string codepoint value with
// Capital and small letter
var_dump(IntlChar::isJavaSpaceChar("V"));
echo "<br>";
  
// Input int char an identifier
// of codepoint value
var_dump(IntlChar::isJavaSpaceChar("u{00A0}"));
echo "<br>";
   
// Input symbolic space codepoint value 
var_dump(IntlChar::isJavaSpaceChar(" "));
echo "<br>";
  
// Input symbolic codepoint value 
var_dump(IntlChar::isJavaSpaceChar(" ^ "));
echo "<br>";
  
// Input string codepoint value 
var_dump(IntlChar::isJavaSpaceChar("Bug"));
echo "<br>";
     
// Input int codepoint value 
var_dump(IntlChar::isJavaSpaceChar("3 "));
echo "<br>";
   
?>

/div>

Output:

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

Program 2:

<?php
// PHP function to illustrate the
// use of IntlChar::isJavaSpaceChar()
   
// Declare an array with
// different codepoint value 
$arr = array("\",
             " "
             " ",
             " #",
             " ",
        );
     
// For loop condition to check 
// each character through function
foreach ($arr as $val) {
         
    // Check each element as code point data
    var_dump(IntlChar::isJavaSpaceChar($val));
    echo "<br>";
}
?>

Output:

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

Related Articles:

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



This article is attributed to GeeksforGeeks.org

You Might Also Like

leave a comment

code

0 Comments

load comments

Subscribe to Our Newsletter