Differences between is_int and is_numeric

Source: Internet
Author: User
: This article mainly introduces the differences between is_int and is_numeric. For more information about PHP tutorials, see. Is_int: indicates a strong type. if the parameter is an int type number, return 1; otherwise, return 0.

Is_numeric: it is a numeric/numeric string (if it is a pure numeric string, false is returned if it has a character), return 1

Example:

Is_numeric (1234); // true

Is_numeric ('20140901'); // true

Is_numeric ('1234e4 '); // false

Is_numeric ('20140901'); // false

Therefore, if no forced conversion/int processing is performed for data transmitted from the front end, it is best to use is_numeric () to ensure that the parameter can be determined through

The differences between is_int and is_numeric are described above, including some content. I hope to help some friends who are interested in PHP tutorials.

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.