Copyright © tutorialspoint.com
| ctype_cntrl ( $text ); |
Checks if all of the characters in the provided string, text, are control characters. Control characters are e.g. line feed, tab, escape.
| Parameter | Description |
|---|---|
| text | Required. The tested string. |
Returns TRUE if every character in text is a control character from the current locale, FALSE otherwise.
Try out following example:
<?php
$strings = array('\n\r\t', 'test123r');
foreach ($strings as $testcase) {
if (ctype_cntrl($testcase)) {
echo "$testcase consists of all control characters.<br />";
} else {
echo "$testcase does not have all all control characters.<br />";
}
}
?>
|
This will produce following result:
\n\r\t consists of all control characters. test123r does not have all all control characters. |
Copyright © tutorialspoint.com