常用的php对象类型判别

<HTML>
<HEAD>
<TITLE>php常用的数值决断函数</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>

复制代码 代码如下:

 

<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>

以下为援用的源委:

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图