ctype_cntrl

(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)

ctype_cntrlVerifica se os caracteres são de controle

Descrição

ctype_cntrl ( string $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.

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

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 irá imprimir:

The string 'string1' consists of all control characters.
The string 'string2' does not consist of all control characters.

Veja Também

add a note add a note

User Contributed Notes 1 note

up
0
Tor
11 years ago
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.
To Top