Home >Backend Development >PHP Tutorial >Several common number judgment function codes in PHP_PHP tutorial

Several common number judgment function codes in PHP_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:19:121011browse

Copy code The code is as follows:



Commonly used values Judgment function


//Judgment 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"."
");
}
?>


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/325323.htmlTechArticleCopy code The code is as follows: HTML HEAD TITLE Commonly used numerical judgment functions/TITLE /HEAD BODY ? //Judge array$ colors = array("red", "blue", "green"); if(is_array($colors)) { print("colo...
Statement:
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