English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The ctype_graph() function performs printable string detection, excluding spaces
ctype_graph(\$text);
Check if the characters output inside the provided text are all visible.
Serial Number | Parameters and Description |
---|---|
1 | text (required) String to be tested |
If each character in the text is printable and actually creates visible output (without spaces), it returns TRUE; otherwise, it returns FALSE.
<?php \$strings = array('string1' => "asdf\n\r\t", 'string2' => 'arf12', 'string3' => 'LKA#@%.54'); foreach (\$strings as \$test) { if (ctype_graph(\$test)) { echo "\$test consists of visible and printable characters\n"; }else { echo "\$test contains invisible characters.\n"; } } ?>Test and see‹/›
Output result:
asdf Contains invisible characters. arf12 Consisting of visible and printable characters LKA#@%.54 Consisting of visible and printable characters