ctype_cntrl
ctype_cntrl
Check for control character(s)
bool **ctype_cntrl** mixed $text
Checks if all of the characters in the provided ,
, are control characters.
Control characters are e.g. line feed, tab, escape.
string``text
textThe tested string.
note.ctype.parameter.integer
note.ctype.parameter.non-string
Returns true if every character in is
a control character from the current locale, false otherwise.
ctype.result.empty-string
text
Voorbeeld: A example
<?php
$strings = array('string1' => "\n\r\t", 'string2' => 'arf12');
foreach ($strings as $name => $testcase) {
if (ctype_cntrl($testcase)) {
echo "The string '$name' consists of all control characters.\n";
} else {
echo "The string '$name' does not consist of all control characters.\n";
}
}
?>
The string 'string1' consists of all control characters.
The string 'string2' does not consist of all control characters.
ctype_print``IntlChar::iscntrl