Open In App

PHP | IntlChar::isISOControl() Function

Last Updated : 04 Nov, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

The IntlChar::isISOControl() function is an inbuilt function in PHP which is used to check whether the input code point is an ISO control code character or not. Specified code point to be determined whether the code point is ISO control code. It is True for general category “Cc” as U+0000…U+001f and U+007f…U+009f.

Syntax:  

bool IntlChar::isISOControl( $codepoint )

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

Return Value: If $codepoint is an ISO control code character then returns True, otherwise return False.

Note: If input code point parameter is String and Numbers then it returns NULL.

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

Program 1:  

PHP




<?php
// PHP code to illustrate
// IntlChar::isISOControl() function
  
// Input control with double " "
// character codepoint value
var_dump(IntlChar::isISOControl("\n"));
 
// Input control with single ''
// character codepoint value
var_dump(IntlChar::isISOControl('\n'));
 
// Input string codepoint value
var_dump(IntlChar::isISOControl("Sudo\tPlacement"));
  
// Input int codepoint value
var_dump(IntlChar::isISOControl("3 "));
 
// Input int codepoint value
var_dump(IntlChar::isISOControl("1\n2\n3\n4\n "));
 
// Input floating codepoint value
var_dump(IntlChar::isISOControl("33.44"));
  
// Input int char an identifier
// of codepoint value
var_dump(IntlChar::isISOControl("\u{007F}"));
 
// Input symbolic codepoint value
var_dump(IntlChar::isISOControl(" @ "));
?>


Output: 

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

Program 2:

PHP




<?php
// PHP code to illustrate
// IntlChar::isISOControl() function
// Declare an array with
// different codepoint value
$arr = array("\r",
             ".",
             " ",
             "\n",
             "\u",
             " ",
             "\t",
             "\\",
        );
  
// For loop condition to check
// each character through function
foreach ($arr as $val) {
      
    // Check each element as code point data
    var_dump(IntlChar::isISOControl($val));
}
?>


Output: 

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

Related Articles: 

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



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads