In PHP, you can judge numbers, characters, objects, arrays, and so on, including those functions such as see Is_bool (), Is_int (), Is_integer (), Is_float (), Is_real (), Is_object (), and Is_array (). I don't know how much you know.
-
-
Double Precision number judgment
Is_double
Is_double-alias of Is_float ()
Description
This function is an alias function for Is_float ().
The code is as follows
$Temperature = 15.23;
if (is_double ($Temperature))
{
Print ("Temperature is a double".) <br> ");
}
Integer judgment
Is_integer-alias of Is_int () and Is_long ()
Description
This function is an alias function for Is_int ().
The code is as follows
$PageCount = 2234;
if (Is_integer ($PageCount))
{
Print ("$PageCount is an integer".) <br> ");
}
Object judgment
Is_object--Detects whether a variable is an object
Description
BOOL Is_object (mixed Var)
Returns TRUE if Var is an object, or FALSE.
The code is as follows
Class Widget
{
var $name;
var $length;
}
$thing = new Widget;
if (Is_object ($thing))
{
Print ("thing is an object".) <br> ");
}
Character judgment
Is_string--Detects whether a variable is a string
Description
BOOL Is_string (mixed Var)
Returns TRUE if Var is string, or FALSE.
The code is as follows
$Greeting = "www.hzhuti.com";
if (is_string ($Greeting))
{
Print ("Greeting is a string".) <br> ");
}
Is_numeric--Detects whether a variable is a numeric or numeric string
Description
BOOL Is_numeric (mixed Var)
Returns TRUE if Var is a numeric and numeric string, or FALSE.
The code is as follows
$int = 1;
if (Is_numeric ($int))
{
Print ("This is a real number, pure man".) <br> ");
}
Okay this article here is simply about the PHP object, the number, the character Judge function, the difficulty relatively super simple.