Home > php教程 > php手册 > PHP数字判断函数

PHP数字判断函数

WBOY
Release: 2016-06-13 09:36:48
Original
1147 people have browsed it

PHP的几个常用数字判断函数代码,主要包括双精度,整数,字符判断等。

 
 
<title>常用的数值判断函数</title> 
 
 
 
//判断数组 
$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>"); 
} 
?> 
 
Copy after login

您可能感兴趣的文章

  • PHP将阿拉伯数字转化为汉字的函数
  • PHP 生成连续的数字(字母)数组函数range()分析,PHP抽奖程序函数
  • PHP常用的判断变量的函数
  • php最精确的字符串长度截取函数
  • php获取汉字拼音首字母的函数(真正可以使用的)
  • php判断函数,类,类方法是否存在
  • php判断来访蜘蛛信息的函数
  • php读取目录并列表显示目录中的文件的函数
Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template