Returns true if bytes are in the range of \x00-\x1f or \x7f (del). Returns false if bytes are in the range of \x20-\x7e or \x80-\xff.
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
ctype_cntrl — Verifica se os caracteres são de controle
$text
): bool
Verifica se todos os caracteres na string fornecedia,
text
, são caracteres de controle.
Caracteres de controle são e.g. line feed, tab, escape.
text
A string a ser testada.
Retorna true
se todos caracteres em text
são
caracteres de controle do atual locale, false
caso contrário.
Exemplo #1 Um exemplo da ctype_cntrl()
<?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";
}
}
?>
O exemplo acima produzirá:
The string 'string1' consists of all control characters. The string 'string2' does not consist of all control characters.