PHP实例:常用的数值判断函数_PHP教程
程序员文章站
2024-01-13 22:50:04
...
常用的对象类型判断
常用的数值判断函数
//判断数组
$colors = array("red", "blue", "green");
if(is_array($colors))
{
print("colors is an array"."
");
}
//双精度数判断
$Temperature = 15.23;
if(is_double($Temperature))
{
print("Temperature is a double"."
");
}
//整数判断
$PageCount = 2234;
if(is_integer($PageCount))
{
print("$PageCount is an integer"."
");
}
//对象判断
class widget
{
var $name;
var $length;
}
$thing = new widget;
if(is_object($thing))
{
print("thing is an object"."
");
}
//字符判断
$Greeting = "Hello";
if(is_string($Greeting))
{
print("Greeting is a string"."
");
}
?>
//判断数组
$colors = array("red", "blue", "green");
if(is_array($colors))
{
print("colors is an array"."
");
}
//双精度数判断
$Temperature = 15.23;
if(is_double($Temperature))
{
print("Temperature is a double"."
");
}
//整数判断
$PageCount = 2234;
if(is_integer($PageCount))
{
print("$PageCount is an integer"."
");
}
//对象判断
class widget
{
var $name;
var $length;
}
$thing = new widget;
if(is_object($thing))
{
print("thing is an object"."
");
}
//字符判断
$Greeting = "Hello";
if(is_string($Greeting))
{
print("Greeting is a string"."
");
}
?>
推荐阅读
-
PHP实例:常用的数值判断函数_PHP教程
-
GD输出汉字的函数的分析_PHP教程
-
解析PHP中ob_start()函数的用法_PHP教程
-
PHP执行系统命令的有几个常用的函数_PHP教程
-
php中判断数组相等的方法以及数组运算符介绍,数组运算符_PHP教程
-
php 中require和include引用url和 php的文件编码转换函数问题_PHP教程
-
php的mysql函数仿pdo操作数据库类_PHP教程
-
PHP生成扭曲有角度支持中文的图片验证码函数_PHP教程
-
WordPress中设置Post Type自定义文章类型的实例教程_PHP
-
PHP中header函数的用法及其注意事项详解_php实例