Skip to content
Related Articles

Related Articles

Improve Article

PHP | IntlChar::isIDIgnorable() Function

  • Last Updated : 27 Aug, 2019
Geek Week

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




My Personal Notes arrow_drop_up
Recommended Articles
Page :