Delicious Bookmark this on Delicious Share on Facebook SlashdotSlashdot It! Digg! Digg



PHP : Function Reference : Character Type Functions : ctype_punct

ctype_punct

Check for any printable character which is not whitespace or an alphanumeric character (PHP 4 >= 4.0.4, PHP 5)
bool ctype_punct ( string text )

Example 423. A ctype_punct() example

<?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";
   }
}
?>

The above example will output:

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

Change Language


Follow Navioo On Twitter
ctype_alnum
ctype_alpha
ctype_cntrl
ctype_digit
ctype_graph
ctype_lower
ctype_print
ctype_punct
ctype_space
ctype_upper
ctype_xdigit
eXTReMe Tracker