Open In App

PHP | IntlChar::isIDIgnorable() Function

Improve
Improve
Like Article
Like
Save
Share
Report

The IntlChar::isIDIgnorable() function is an inbuilt function in PHP which is used to determine the code point is an ignorable character or not. It is TRUE for characters with general category “Cf” (format controls) as well as non-whitespace ISO controls ( U+0000…U+0008, U+000E…U+001B, U+007F…U+009F).

Syntax:

bool IntlChar::isIDIgnorable( $codepoint )

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

Return Value: If $codepoint is an ignorable identifier then returns True, otherwise return False.

Below programs illustrate the IntlChar::isIDIgnorable() Function in PHP.
Program 1:




<?php
  
// PHP code to illustrate
// IntlChar::isIDIgnorable() function
  
// Input character codepoint value 
var_dump(IntlChar::isIDIgnorable("X"));
echo "<br>";
  
// Input symbolic codepoint value 
var_dump(IntlChar::isIDIgnorable("^ "));
echo "<br>";
  
// Input int codepoint value 
var_dump(IntlChar::isIDIgnorable("3 "));
echo "<br>";
  
// Input int char an identifier
// of codepoint value
var_dump(IntlChar::isIDIgnorable("\u{007F}"));
echo "<br>";
  
var_dump(IntlChar::isIDIgnorable("\u{012C}"));
echo "<br>";
  
// Input string codepoint value 
var_dump(IntlChar::isIDIgnorable("Geeks"));
echo "<br>";
  
?>


Output:

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

Program 2:




<?php
  
// PHP code to illustrate
// IntlChar::isIDIgnorable function
  
// Declare an array $arr
$arr = array("G", "\u{007F}", ".", "8", "/",
              "\u{000}", "\t", "\u{007}", "\u{0AB}" );
  
// Loop run for every array element
foreach ($arr as $val){
      
    // Check each element as code point data
    var_dump(IntlChar::isIDIgnorable($val));
    echo "<br>";
}
?>


Output:

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

Related Articles:

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



Last Updated : 27 Aug, 2019
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads