IntlChar::isISOControl() function in PHP

The IntlChar::isISOControl() function is used to check whether the entered value is an ISO control code character or not. ISO control characters are non-printing characters in the range U+0000-U+001F (C0 controls) and U+007F-U+009F (C1 controls).

Syntax

IntlChar::isISOControl(mixed $codepoint): ?bool

Parameters

  • codepoint − A character or integer value encoded as a UTF-8 string, or an integer representing a Unicode code point.

Return Value

The IntlChar::isISOControl() function returns TRUE if the entered value is an ISO control code character, FALSE otherwise, or NULL on failure.

Example

The following example demonstrates checking various characters for ISO control codes ?

<?php
    // Check regular characters
    var_dump(IntlChar::isISOControl("A"));
    echo "<br>";
    
    // Check newline character (ISO control)
    var_dump(IntlChar::isISOControl("<br>"));
    echo "<br>";
    
    // Check tab character (ISO control)
    var_dump(IntlChar::isISOControl("\t"));
    echo "<br>";
    
    // Check digit
    var_dump(IntlChar::isISOControl("1"));
    echo "<br>";
    
    // Check using Unicode code points
    var_dump(IntlChar::isISOControl(0x0A)); // Line feed
    echo "<br>";
    
    var_dump(IntlChar::isISOControl(0x7F)); // Delete character
?>

The output of the above code is ?

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

Common ISO Control Characters

Character Code Point Description

U+000A Line Feed
\t U+0009 Tab
\r U+000D Carriage Return
DEL U+007F Delete Character

Conclusion

The IntlChar::isISOControl() function is useful for identifying ISO control characters in Unicode text processing. It returns TRUE for characters in the C0 and C1 control ranges, making it valuable for text validation and formatting tasks.

Updated on: 2026-03-15T07:45:03+05:30

142 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements