PHP的資料型別有四種、8個
一、標量型別
-
整型(integer)
-
浮點型(floor)
-
字串(string)
-
布爾型(bloon)
二、復雜型別
-
陣列(array)
-
物件(object)
三、特殊型別
-
NULL
-
資源(resource)
1 <?php 2 $a_bool = TRUE ; // a boolean 3 $a_str = "foo" ; // a string 4 $a_str2 = 'foo' ; // a string 5 $an_int = 12 ; // an integer 6 7 echo gettype ( $a_bool ); // prints out: boolean 8 echo gettype ( $a_str ); // prints out: string 9 10 // If this is an integer, increment it by four 11 if ( is_int ( $an_int )) { 12 $an_int += 4 ; 13 } 14 15 // If $bool is a string, print it out 16 // (does not print out anything) 17 if ( is_string ( $a_bool )) { 18 echo "String: $a_bool " ; 19 } 20 ?>
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/24277.html
標籤:Windows
