Migrating from C/C ++ to PHP -- determining the character type function _ PHP Tutorial

Source: Internet
Author: User
Migrate from CC ++ to PHP-a function that determines the character type. In CC ++, the header file ctype. h defines a set of macros for character types to obtain the type of the given characters. PHP does not have related functions. A few days ago, I found that in PHP downloaded from www.mm4.de, in C/C ++, the header file ctype. h defines a set of macros for the character type to get the type of the 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! ";
}

?>

Appendix: functions supported by php_ctype.dll
Bool isalnum (string)
Bool isalpha (string)
Bool iscntrl (string)
Bool isdigit (string)
Bool isgraph (string)
Bool islower (string)
Bool isprint (string)
Bool ispunct (string)
Bool isspace (string)
Bool isupper (string)
Bool isxdigit (string)

[This article is copyrighted by the author Fan Cao 0515 and osuo. if you need to reprint it, please indicate the author and its source]

Bytes. PHP does not have related functions. A few days ago, I found PHP downloaded at www.mm4.de...

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.