Learn How to Use PHP Function Ctype_Space
Learn How to Use PHP Function ctype_space
The php function ctype_space is part of the ctype extension (Ctypes) which lets you validate the types of variables and functions. The ctype_space function checks whether a string contains only whitespace characters, which includes horizontal tab, vertical tab, line feed, carriage return and form feed characters.
The test string must be all lowercase or uppercase letters from A to Z. Moreover, the test string must not contain any numbers or special symbols like underscores and periods. In case of failure, the ctype_space function will return False.
Note: The ctype_space function is EXPERIMENTAL. This means that the behaviour of this function can change in a future release of PHP without notice. So please use it at your own risk and make sure that you keep up with the latest version of PHP.
The ctype_alpha() function is similar to ctype_space, except that it tests whether the input string is alphabetic or not. The test string must be all lowercase or capital letters from A to Z. Moreover, it must not contain any numbers or special symbols like commas and ampersands. The ctype_alpha() function will return True if the test string is alphabetic, and False otherwise.