Php Data type conversion: php Data Type Conversion
1: Overview --- php is a weak language that can automatically convert data types based on changes in the runtime environment
1.1 principle of converting to a Boolean Type
The following values are converted to false in the Boolean Type:
A. boolean type false;
B. Empty string''
C. Positive 0 or floating point 0.0 or string '0' (excluding the string '0. 0 ')
D. array without members ---- array ()
E. null
Other values are converted to true.
1.2 principle of converting to numeric type
A. If the string is A valid numeric string that does not contain./e/E and does not exceed the storage range of an integer, it is converted to an integer. Otherwise, it is converted to A floating point type;
B. If the digit string starts with an invalid character, it is converted to 0;
C. Convert Boolean true to integer 1 and false to integer 0;
D. Convert null to 0
E. Round down when the floating point is converted to an integer
1.3 principle of converting to a string
A. Convert the value into A string, that is, the value itself;
B. Convert Boolean true to string '1'; Convert false to string '';
C. Convert null to an empty string '';
D. convert an Array to an Array
E. The resource will be converted to Resourse id # Number