Variable type Common methods for determining variable type in PHP

WBOY
Release: 2016-07-29 08:48:25
Original
1088 people have browsed it

Now let us understand the specific usage
gettype()
gettype will return the following values ​​​​according to the parameter type
"boolean" (from PHP 4)
"integer"
"double" (if it is float, it will return "double", instead of "float")
"string"
"array"
"object"
"resource" (from PHP 4)
"NULL" (from PHP 4)
"unknown type"
For example:
gettype(' 1'); returns string
and gettype(1); returns integer
is_array()
is_array() is relatively simple to use
If the parameter is an array, it returns true, otherwise it returns false
The usage and returns of several other functions The value is similar to is_array()
It should be noted here that is_numeric() is used to determine whether the variable is a number or a string of numbers
When the parameter of is_numeric() is a number or a string of numbers, it returns true, otherwise it returns false

The above has introduced the common methods of determining variable types in PHP, including the content of variable types. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!