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.

Esempio 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().