Check for whitespace character(s)
Syntax
ctype_space(mixed $text): bool
Parameters
text
The tested string.
Note: If an integer between -128 and 255 inclusive is provided, it is interpreted as the ASCII value of a single character (negative values have 256 added in order to allow characters in the Extended ASCII range). Any other integer is interpreted as a string containing the decimal digits of the integer.
Return
Returns true if every character in text creates some sort of white space, false otherwise.
Besides the blank character this also includes tab, vertical tab, line feed, carriage return and form feed characters.
Examples
1
<? $text = "\x09\x0a\x0b\x0c\x0d\x20\t\n\v\f\r "; $return = ctype_space($text); var_export($return); ?>
true
2
<? for($i = 0; $i <= 255; ++$i) { $return = ctype_space($i); if($return) { $character = chr($i); echo "$i: $character\n"; } } ?>
9: 10: 11: 12: 13: 32: