PHP的幾個常用數字判斷函數代碼,主要包括雙精度,整數,字符判斷等。
<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>