The difference between print and echo in php and the difference between "" and''

Source: Internet
Author: User
The difference between print and echo in php and the difference between "" and ''can be output in the echo function at the same time, while in the print function, only one string can be output at the same time. At the same time, the echo function does not need parentheses, so the echo function is more like a statement than a function. & Lt ;? $ Ahello; $ bworld; echoa, B; differences between print and echo in printa and B php, and the differences between "" and''

In the echo function, multiple strings can be output at the same time, while in the print function, only one string can be output at the same time. At the same time, the echo function does not need parentheses, so the echo function is more like a statement than a function.

$ A = "hello ";

$ B = "world ";

Echo "a", "B ";

Print "a", "B ";

?>

In print "a", "B"; this sentence is wrong. only the echo function can be written like this.


--- The processing of single and double quotation marks is different in PHP. The content in the double quotation mark string can be interpreted and replaced, while the content in the single quotation mark string is always considered as a common character.

If $ value = "I am a value ";

Echo "$ value ";-----? The output is: I am a value.

Echo '$ value ';-----? The output is: $ value


PHP identifier, and PHP comments:

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.