In PHP, there are a series of functions that detect data types. different types of data can be checked to determine whether the data belongs to the MiG data type. If yes, true is returned; otherwise, false is returned. Php: an array of data type instances. in PHP, there are a series of functions that can be used to detect different types of data to determine whether the data belongs to the MiG data type, if yes, true is returned. otherwise, false is returned.
The following table lists the functions used by PHP to detect data types:
Function |
Detection type |
Example |
Is_bool |
Check whether the variable is Boolean |
Is_bool (true), is_bool (false) |
Is_string |
Checks whether the variable is of the string type. |
Is_string ('string'), is_string (1234) |
Is_integer/is_int |
Check whether the variable is an integer. |
Is_integer (34), is_integer ('34 ') |
Is_float/is_double |
Checks whether the variable is of the floating point type. |
Is_float (3.1415), is_float ('3. 1415 ') |
Is_array |
Checks whether the variable is of the array type. |
Is_array ($ arr) |
Is_object |
Checks whether the variable is an object type. |
Is_object ($ obj) |
Is_null |
Checks whether the variable is null. |
Is_null (null) |
Is_numeric |
Checks whether the variable is a string consisting of digits or numbers. |
Is_numeric ('5'), is_numeric ('bccd110 ') |
PHP Data type detection instance
PHP checks whether the functions and usage of the data type are the same. the following example uses the is_numeric () function to check whether the data in the variable is a number.
Code running result:
The above example is the usage of our is series functions.
In this chapter, we will explain a series of PHP Data types: eight data types of PHP, php: boolean data type instances, php: string) details about data type instances, php: integer data type instances, php: float data type instances, php: array data type instances, php: details about object data type instances, php: resource data type instances, php: null data type instances, I hope you will learn more about php Data types through this series.
Related video tutorials are recommended: php1.cn solitary 9 cheap (4)-php Video Tutorial: PHP data type
The above is a detailed description of the PHP Data type detection instance. For more information, see other related articles in the first PHP community!