In the PHP language, for digital characters and numbers how to participate in the operation, in specific cases will be determined, for example: echo "3+4+5"; Results: 3+4+5. Because it is treated as a string. When echo1+2+ "3+4+5", it is treated as an expression. This involves the problem of different data type operations in PHP. Data of different data types when participating in data, PHP will convert data to try to ensure that the expression successfully run, in the "3+4+5" before the operator is +, then, PHP will "3+4+5" as a numeric type, when the data type is implicitly converted, the string is converted to a numeric value, The rule for a PHP string to an integer is to extract as many numbers as possible from the front of the string, followed by a non-numeric part being discarded. "3+4+5" is a string, enter the numerical calculation, will be hard to convert the string to a numeric value, usually take the first string, if it is a numeric string, it is a complete number. Therefore, the result of the conversion of "3+4+5" to a number is 3, so the result of the entire expression is: 1+2+3=
6.
<?php
Echo (1+2). " 3+4+5 ";
?>
The result of the output is 33+4+5
This article is from the "12145704" blog, please be sure to keep this source http://12155704.blog.51cto.com/12145704/1867829
The result of the echo 1+2+ "3+4+5" Output is 6