PHP data type automatic conversion, PHP data type conversion
1: Overview---PHP is a weakly typed language that can automatically convert data types based on changes in the operating environment
1.1 Principles for converting to Boolean types
The following values are converted to False in the Boolean type:
A. False for Boolean type;
B. Empty string "'
C. Positive 0 or floating-point number 0.0 or string ' 0 ' (excluding string ' 0.0 ')
D. Arrays with no members----Array ()
E.null
In addition, other values are converted to true.
1.2 Principle of conversion into numerical type
A. If the string is a valid numeric string and does not contain./e/e, and does not exceed the range of the integer type, it is converted to an integer type;
B. If the numeric string starts with an illegal character, it is converted to 0;
C. True conversion of Boolean to integer 1,false converted to integer 0;
D.null conversion to 0
E. Rounding down when floating-point numbers are converted to integers
1.3 Principles for converting to strings
A. The numeric value is converted into A string that is the value itself;
B. True conversion of Boolean to string ' 1 '; false to convert to string ';
C.null converted into an empty string ';
D. Array to be converted into array
E. Resources will be converted to Resourse ID #数字
http://www.bkjia.com/PHPjc/1035425.html www.bkjia.com true http://www.bkjia.com/PHPjc/1035425.html techarticle PHP Data type automatic conversion, PHP data type conversion 1: Overview---PHP is a weak type of language, it can be automatically based on the changes in the operating environment of the conversion of data type 1.1 conversion ...