Home  >  Article  >  Backend Development  >  PHP number judgment function_PHP tutorial

PHP number judgment function_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:31:301008browse

Several common number judgment function codes in PHP, mainly including double precision, integer, character judgment, etc.

<HTML> 
<HEAD> 
<TITLE>常用的数值判断函数</TITLE> 
</HEAD> 
<BODY> 
<? 
//判断数组 
$colors = array("red", "blue", "green"); 
if(is_array($colors)) 
{ 
print("colors is an array"."<br>"); 
} 
//双精度数判断 
$Temperature = 15.23; 
if(is_double($Temperature)) 
{ 
print("Temperature is a double"."<br>"); 
} 
//整数判断 
$PageCount = 2234; 
if(is_integer($PageCount)) 
{ 
print("$PageCount is an integer"."<br>"); 
} 
//对象判断 
class widget 
{ 
var $name; 
var $length; 
} 
$thing = new widget; 
if(is_object($thing)) 
{ 
print("thing is an object"."<br>"); 
} 
//字符判断 
$Greeting = "Hello"; 
if(is_string($Greeting)) 
{ 
print("Greeting is a string"."<br>"); 
} 
?> 
</BODY> 
</HTML>

Articles you may be interested in

  • PHP function to convert Arabic numerals into Chinese characters
  • PHP generates continuous number (letter) array function range() analysis , PHP lottery program function
  • PHP commonly used function to judge variables
  • php’s most accurate string length interception function
  • php function to get the first letter of Chinese pinyin (really can Used)
  • php determines whether functions, classes, and class methods exist
  • php function to determine visiting spider information
  • php reads the directory and lists the files in the directory Function

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/764080.htmlTechArticle Several common number judgment function codes in PHP, mainly including double precision, integer, character judgment, etc. HTML HEAD TITLE commonly used numerical judgment functions/TITLE /HEAD BODY ? //Judge array $color...
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