The conversion of PHP variable types is very flexible, the most common is the conversion of strings and numbers or the number/string to Boolean worthwhile conversion.
1. String-to-number conversion, first write an example:
<? PHP $a= ' PNs '; $a=$a+3; Var_dump ($a);? >
The result is int (40), the value of a is changed to ' 37.5 ', the output is float (40.5), and instead of ' 37hello ', then the output is int (40), but instead of ' hello37 ', the output is int (3), This can be summed up the string into a number of laws, the string into a number, that is, from left to right to intercept the number, until it is not a valid number stop, the intercepted part of the conversion into numbers.
2. The number is converted into a string, as follows
<? PHP $a=108; $a=$a. ' Hyper '; Var_dump ($a);? >
The output is, the above string concatenation operation, is to see this number in the original string.
3. Numbers and string-to-Boolean judgments
", ' 0 ', 0,0.0,null,array () when these are converted to Boolean values, are false.
PHP Learning Note-variable type conversion