ctype_cntrl
(PHP 4 >= 4.0.4, PHP 5)
ctype_cntrl — Verifica se os caracteres são de controle
Descrição
bool ctype_cntrl
( string $text
)
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.
Parâmetros
- text
-
A string a ser testada.
Valor Retornado
Retorna TRUE se todos caracteres em text são caracteres de controle do atual locale, FALSE caso contrário.
Exemplos
Example#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 irá imprimir:
The string 'string1' consists of all control characters. The string 'string2' does not consist of all control characters.