Home > Article > Backend Development > PHP number, character, object judgment function_PHP tutorial
Judging numbers, characters, objects, arrays, etc. in PHP includes functions such as is_bool(), is_int(), is_integer(), is_float(), is_real(), is_object() and is_array(). I don’t know how much you know. Woolen cloth.
//Double precision number judgment
is_double
is_double -- alias of is_float()
Description
This function is an alias for is_float().
The code is as follows | Copy code | ||||
if(is_double($Temperature)) { print("Temperature is a double"." ");
} |
代码如下 | 复制代码 |
$PageCount = 2234; if(is_integer($PageCount)) { print("$PageCount is an integer"." "); } |
Description
This function is an alias for is_int().
The code is as follows | Copy code |
$PageCount = 2234;
if(is_integer($PageCount)) } |
//Object judgment
代码如下 | 复制代码 |
class widget |
is_object -- Check whether the variable is an object
Description
bool is_object (mixed var)
Returns TRUE if var is an object, FALSE otherwise.
The code is as follows | Copy code | ||||
class widget var $length; }
if(is_object($thing)) |
//Character judgment
代码如下 | 复制代码 |
$int = 1; |
The code is as follows | Copy code |
$Greeting = "www.hzhuti. com "; if(is_string($Greeting)) { print("Greeting is a string"." "); } |
The code is as follows | Copy code |
$int = 1; if(is_numeric($int)) { print("This is a real number, just a man"." "); } |
Okay, this article just briefly talks about the object, number, and character judgment functions in PHP. The difficulty is relatively simple.