Forum und email

ctype_punct

(PHP 4 >= 4.0.4, PHP 5)

ctype_punct — Controlla ogni carattere stampabile che non è uno spazio o un carattere alfanumerico

Descrizione

bool ctype_punct ( string $testo )

Restituisce TRUE se ogni carattere di testo è stampabile, ma non è nè una lettera nè; una cifra nè uno spazio, FALSE in caso contrario.

Example#1 Esempio di uso di ctype_punct()

<?php
$strings 
= array('ABasdk!@!$#''!@ # $''*&$()');
foreach (
$strings as $testcase) {
    if (
ctype_punct($testcase)) {
        echo 
"The string $testcase consists of all punctuation.\n";
    } else {
        echo 
"The string $testcase does not consist of all punctuation.\n";
    }
}
?>

Questo esempio visualizzerà :

The string ABasdk!@!$# does not consist of all punctuation.
The string !@ # $ does not consist of all punctuation.
The string *&$() consists of all punctuation.

Vedere anche ctype_cntrl() e ctype_graph().