IntlChar::iscntrl() function in PHP

The IntlChar::iscntrl() function is used to check the given input is a control character or not. Examples include line feed (
), tab (\t), etc.

Syntax

IntlChar::iscntrl( val )

Parameters

  • val − An integer values or character encoded as a UTF-8 string.

Return

The IntlChar::iscntrl() function returns TRUE if the val is a control character.

Example

The following is an example −

"));
   echo "
";    var_dump(IntlChar::iscntrl("ahjh"));    echo "
";    var_dump(IntlChar::iscntrl("12345")); ?>

Output

The following is the output −

bool(true)
NULL
NULL

Example

Let us now see another example wherein we are checking whether the entered value is a control character or not −

";
   var_dump(IntlChar::iscntrl("878"));
   echo "
"; ?>

Output

The following is the output −

bool(true)
NULL
Updated on: 2019-12-30T07:39:32+05:30

165 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements