The following is a summary of several methods for detecting data types in PHP ). I think this is quite good. now I will share it with you and give you a reference. Let's take a look at the following small series to bring you a PHP several methods for detecting data types (summary ). I think this is quite good. now I will share it with you and give you a reference. Let's take a look at it with Xiaobian.
In JavaScript, typeof can be used to detect basic data types, and instanceof can be used to detect referenced data types. In PHP, there are also methods for detecting data types, as shown below:
1. gettype)
2. data type, quantity, and content of the output variable (var_dump)
View source code printing Code Help
3. check whether a variable is of the specified data type (is_array, is_string, is_int, is_double, etc.). if it is true, return 1. if it is false, return null.
View source code printing Code Help
Maybe your friend is looking for the answer to this question. please share it with him!
The above is a summary of several methods and tips for PHP to detect data types. For more information, see PHP Chinese website (www.php1.cn )!