Migrate from C/C ++ to PHP -- a function that determines the character type
Source: Internet
Author: User
Migrate from CC ++ to PHP -- function for determining character type in C/C ++, header file ctype. h defines a set of macros for character types to obtain the type of a given character.
PHP does not have related functions. The other day I found that an extension Library named php_ctype.dll was provided in PHP downloaded from www.mm4.de,
Some of these functions are provided after loading, which are specially sorted out for your reference.
After correctly loading the php_ctype.dll file in PHP, use You can see the following information:
Ctype
Ctype functions enabled (experimental)
Then you can use the functions it provides. The usage of all functions is basically the same as that of C/C ++. The difference is that the function parameters in C/C ++ are
Character type (char), while the function parameter in PHP can be a string ). For example:
$ String = "123 ADAADAD ";
If (isalnum ($ string ))
{
Echo "only contains uppercase and lowercase letters and numbers! ";
}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service