Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - In php: Hello echo, echo 123, the above two echoes are not quoted, why can they be output correctly?
In php: Hello echo, echo 123, the above two echoes are not quoted, why can they be output correctly?
This is the fault tolerance of the system, but it should be used as a warning.

Formal usage should be quoted.

The landlord can try.

If the definition

$ a = 1;

then

Echo, hello, $ a;; An error will occur.

But if

Echo "hello, $ TERM"; It's normal output.

Of course. Hello, echo. $ a; The output is also normal.

Please put quotation marks when using it again.

If echo 123 is not referenced, the system should default to a string.

echo“ 123”; Also considered as a string.

$ a = 1;

echo $ a; Think of it as an integer numeric variable.

Of course, if a constant is defined as 123 (123)

Then the output of this constant is also regarded as the number 123.

Actually, the string 123 is the same as the number 123.