ctype_space
Description
The ctype_space of Ctype for PHP checks for whitespace character(s).
Syntax
ctype_space(
mixed $text
): boolParameters
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. When called with an empty string the result will always be false.
Examples
1 · text · empty
<? $text = ""; $return = ctype_space($text); var_export($return);
false
2 · text · whitespace
<? $text = "\x09\x0a\x0b\x0c\x0d\x20\t\n\v\f\r "; $return = ctype_space($text); var_export($return);
true
3 · text · integer
<?
for($i = -128; $i <= 255; ++$i)
{
$return = ctype_space($i);
if($return)
{
echo "$i: ". chr($i). PHP_EOL;
}
}
9: 10: 11: 12: 13: 32: