首頁 >後端開發 >php教程 >PHP数据类型判断函数总结

PHP数据类型判断函数总结

WBOY
WBOY原創
2016-06-20 13:04:231203瀏覽

PHP数据类型判断函数总结

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


陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn