How does PHP use const to define another constant with one constant?

Source: Internet
Author: User
ConstX & #039; x & #039; constXXX. & #039; x & #039; the second line has a syntax error. What is the correct format. As shown below

Const X = 'X ';
Const XX = X. 'X ';

The second line has a syntax error. What is the correct format.

Reply content:

As shown below

Const X = 'X ';
Const XX = X. 'X ';

The second line has a syntax error. What is the correct format.

Upgrade PHP5.6

Http://cn2.php.net/manual/zh/migration56.new-features.php#migration56.new-features.const-scalar-exprs

Constant Value; only scalar and null are allowed. The scalar type is integer, float, string, or boolean.
It can also define the type of constant value as resource, but it is not recommended to do so, it may cause unknown conditions.

Solution:

Const X1 = 'x1'; const X2 = 'x2'; echo X1.X2;

Of course you can also choose to upgrade, as @ mcfog said ~

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.