Commonly used object type judgments
Commonly used numerical judgment functions
< ;?
//Judge array
$colors = array("red", "blue", "green");
if(is_array($colors))
{
print( "colors is an array"."
");
}
//Double precision number judgment
$Temperature = 15.23;
if(is_double($Temperature))
{
print("Temperature is a double"."
");
}
//Integer judgment
$PageCount = 2234;
if(is_integer($PageCount) )
{
print("$PageCount is an integer"."
");
}
//Object judgment
class widget
{
var $name;
var $length;
}
$thing = new widget;
if(is_object($thing))
{
print("thing is an object". "
");
}
//Character judgment
$Greeting = "Hello";
if(is_string($Greeting))
{
print(" Greeting is a string"."
");
}
?>
< ;?
//Judge array
$colors = array("red", "blue", "green");
if(is_array($colors))
{
print( "colors is an array"."
");
}
//Double precision number judgment
$Temperature = 15.23;
if(is_double($Temperature))
{
print("Temperature is a double"."
");
}
//Integer judgment
$PageCount = 2234;
if(is_integer($PageCount) )
{
print("$PageCount is an integer"."
");
}
//Object judgment
class widget
{
var $name;
var $length;
}
$thing = new widget;
if(is_object($thing))
{
print("thing is an object". "
");
}
//Character judgment
$Greeting = "Hello";
if(is_string($Greeting))
{
print(" Greeting is a string"."
");
}
?>