Syntax
ctype_print ( $text ); |
Definition and Usage
This function checks if all of the characters in the provided string, text, are printable.
Paramters
Parameter | Description |
---|---|
text | Required. The tested string. |
Return Value
Returns TRUE if every character in text will actually create output (including blanks). Returns FALSE if text contains control characters or characters that do not have any output or control function at all.
Example
Try out following example:
<?php $strings = array('asdf\n\r\t', 'arf12', "fooo#int%@"); foreach ($strings as $testcase) { if (ctype_print($testcase)) { echo "$testcase consists of all printable characters.<br />"; } else { echo "$testcase does not have all printable characters.<br />"; } } ?> |
This will produce following result:
asdf\n\r\t does not have all printable characters. arf12 consists of all printable characters. fooo#int%@ consists of all printable characters. |
No comments:
Post a Comment