The doubt of the point number
PHP Code
Echo ' 1+5= '. 1; Why this write will be error echo ' 1+5= '. 1; This sentence can execute echo ' 1+5= '. (1);//Get a brace outside
------Solution--------------------
When adjacent to a number, it is recognized as a decimal
and less than 1 decimal can omit the start of 0, such as 0.1 written. 1 is legal.
So ' 1+5 '. 1 is parsed into two contiguous constants, and there are no operators between them, which will naturally result in an error.
Similarly, 1. " ABC "will also error
------Solution--------------------
When it is adjacent to a number, it is recognized as a decimal, as the second floor says.
Echo ' 1+5= '. 1; This sentence can be executed: in PHP is the meaning of the connector, is the meaning of string connection.
------Solution--------------------
As Hengyu654 said, "." Direct numbers are not treated as string literals and are treated as decimal points
As follows:
PHP Code
echo "THR". " EE "; Output string "Three" echo "TWE". "Lve"; Output string "Twelve" Echo 1. 2; Output string "1.2" echo; Output digital 1.2echo 1.. 2;