Php Data type conversion: php Data type conversion. Php Data type conversion: php Data type conversion 1: Overview --- php is a weak type language, it can automatically convert data types according to changes in the runtime environment 1.1 convert php Data types automatically convert, 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
Tip 1: overview --- php is a weak language that can automatically convert data types by 1.1 based on changes in the runtime environment...