(ii) BASIC syntax---Output statements echo and print

Source: Internet
Author: User
Tags php print

1. Echo Statement

2. Print Statements


The difference between the two

echo-capable of outputting more than one string, no return value

Print-can only output one string and return a value of 1

echo is faster than print at run time because it has no return value.


Echo statement

Echo is a language structure that can be used without parentheses. Echo and Echo ().

<?php echo "Hello world!<br>";    Echo ("Hello world!<br>"); echo "Hello", "world!";? >

The string can contain HTML code that can be parsed normally.


Print statement

Print is also a language structure that can be used without parentheses: print or print () with a return value of 1

<?php print "Hello world!<br>";    Print ("Hello world!<br>"); Print "Hello", "world!";? >

Think: How do I see the print return value?

<?php Echo (print "Hello world!");? >

The return value is 1.



This article is from the "Thales" blog, make sure to keep this source http://thales.blog.51cto.com/7311175/1631754

(ii) BASIC syntax---Output statements echo and print

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.