Talking about the data type judgment function of variables in php, talking about the data type

Source: Internet
Author: User

Talking about the data type judgment function of variables in php, talking about the data type

In php, We can print the type and value of the variable through var_dump. At the same time, we can use some functions to determine the type of the variable. If you only want to get the data type of a variable, you can use the gettype () function. gettype ($ t) returns a $ t data type string, if $ t does not belong to eight basic variable types in php, "unknow type" is returned ". We can also use the is_type class function to directly determine whether it is a type function. If yes, true is returned, rather than false.

For example:


Is is_bool () Boolean?
Whether is_int () is an integer
Whether is_float () is float
Whether is_string () is string type
Whether is_array () is array type
Whether is_object () is of the Object Type
Whether is_resource () is a resource type
Is_null () is empty?
Whether is_scalar () is a scalar type is an integer floating-point Boolean type or a string type.
Whether is_numeric () is a numeric or numeric string of any type
Whether is_callable () is a valid function name

In the above discussion, the Data Type judgment function of variables in php is all the content that I have shared with you. I hope to give you a reference and support for the help house.

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.