Copyright © tutorialspoint.com
| ctype_punct ( $text ); |
This function checks if all of the characters in the provided string, text, are punctuation character.
| Parameter | Description |
|---|---|
| text | Required. The tested string. |
Returns TRUE if every character in text is printable, but neither letter, digit or blank, FALSE otherwise.
Try out following example:
<?php
$strings = array('ABasdk!@!$#', 'foo!#$bar', '*$()');
foreach ($strings as $testcase) {
if (ctype_punct($testcase)) {
echo "$testcase consists of all punctuation.<br />";
} else {
echo "$testcase does not have all punctuation.<br />";
}
}
?>
|
This will produce following result:
ABasdk!@!$# does not have all punctuation. foo!#$bar does not have all punctuation. *$() consists of all punctuation. |
Copyright © tutorialspoint.com