casts and variable type judgments
<?php/** * Cast and variable type judgment */$int = 1000; Echo GetType ($int); Print Result: integer echo "<br>"; $str = (String) $int; Reshape the string echo GetType ($int); Print Result: integer echo "<br>"; Echo GetType ($STR); Print Result: string echo "<br>"; $int 2 = intval ($STR); String to reshape Echo GetType ($int 2); Print Result: string echo "<br>"; $int 3 = (int) ($STR); String to reshape Echo GetType ($int 3); Print Result: string echo "<br>"; $a = "456e3abchello123 world"; $b = 100; $c = $a + $b; In the process of adding, a does not add Var_dump ($c) as 456e3 scientific counting method; Print Result: Float (456100) echo "<br>"; Gets the variable type of a and determines whether it is a string if (GetType ($a) = = "string") {echo "gettype = = string"; echo "<br>"; }//To determine whether a is null, true, or whether a is null if (Is_null ($a)) {echo "is_null = = true"; echo "<br>"; }else{echo "Is_null = = false"; echo "<br>"; }//Determine if A is an array, whether it is true, or whether a is an array if (Is_array ($a)) {echo "Is_array = = TRUE "; echo "<br>"; }else{echo "Is_array = = false"; echo "<br>"; }//Determine if A is a string, whether it is true, or whether a is a string if (is_string ($a)) {echo "Is_array = = true"; echo "<br>"; }else{echo "Is_array = = false"; echo "<br>"; } is_bool (); Determines whether the Boolean value is Is_int (); Determine whether the plastic is_integer (); Determine whether the plastic is_long (); Determine whether the plastic is_float (); Determines whether the float type is_double (); Determines whether the float type is_real (); Determines whether the float type is_string (); Determines whether the string is Is_array (); Determine if the array is is_object (); Determines whether the object is Is_resource (); Determines whether the resource type is_null (); Determine if it is an empty is_scalar (); Judge whether it is a scalar is_numeric (); Determines whether a variable is a numeric or numeric string. Is_callable (); Determine if the function name is valid
The above is the Android programmer to learn PHP development (7)-The strong variable type judge-phpstorm content, more relevant content please pay attention to topic.alibabacloud.com (www.php.cn)!