This section introduces PHP data types for you to learn about. Syntax: integer values can be expressed in decimal, hexadecimal, or octal, preceded by an optional symbol (-or +). Octal indicates that the number must be preceded by 0 (0), and hexadecimal indicates that the number must be preceded by 0x. Example 1,
"Echo Php_int_max;echo" ";//integer maximum number (2147483647) $fmax =2147483648;var_dump (Php_int_max); A number that exceeds the range of integers will be interpreted as a float type. echo " "; Var_dump ($fmax);? >
Floating-point numbers: floating-point numbers (double-precision or real numbers)
Important understanding: The accuracy is calculated from the first non-0 number that begins on the left. The Boolean type is the simplest type in PHP. It can have a value of TRUE or FALSE. Such as:
True when the output value is: ". $foo 1; Output 1
Details: When converting to Boolean, the following values are considered False:1, the Boolean FALSE itself 2, the integer value 0 (0) 3, the floating-point value 0.0 (0) empty string, and the string "0" 4, the array without any elements 5, not package Object with any member variable (PHP 4.0 only) 6, special type NULL (including variables not yet set) 7, SimpleXML object generated from an XML document without any tags (tags)
"; Var_dump ((bool) array ()); if ($a ==false) {echo" null 0 default conversion to FALSE, success!) ";} Else{echo "cannot be converted to false";}
Output: BOOL (FALSE) bool (FALSE) NULL 0 default conversion to FALSE, success! Thank you for your attention to the PHP introductory tutorial, this series of basic PHP tutorial will help PHP novice friends, quickly master the language of PHP programming. The programmer's home will continue to introduce PHP-related tutorials For everyone, I wish you all the progress of learning! |