Points of doubt to solve the idea

Source: Internet
Author: User
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;                
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.