Question about the efficiency of phpecho string output?

Source: Internet
Author: User
Question about the efficiency of phpecho string output? I want to know which of the following two execution modes is more efficient or has a higher method !!!
Output Format 1
Echo "... 2 ";
Echo "... 3 ";
Echo "... 4 ";
Echo "... 5 ";
Echo "... 6 ";
Echo "... 7 ";


Output Format 2
$ Str. = "... 2 ";
$ Str. = "... 3 ";
$ Str. = "... 4 ";
$ Str. = "... 5 ";
$ Str. = "... 6 ";
$ Str. = "... 7 ";
Echo $ str;


Reply to discussion (solution)

You can't understand it.

This is not much different, depending on which one you are used.

Form 2 requires variable caching, which is naturally inefficient
But at any time, the efficiency is subject to the task.

Refer to here to calculate the execution time
Http://blog.csdn.net/php_boy/article/details/6450678

Of course it is the first one.
Str concatenation, which is more efficient and memory-consuming

Yes
Echo '... A','... B ','... c' // this method

1
High efficiency

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.