Asking about the efficiency of the PHP echo string output?

Source: Internet
Author: User
Want to know the following two forms of execution, which is more efficient, or have a higher method!!!
Output Form 1
echo ".... 2 ";
echo ".... 3 ";
echo ".... 4 ";
echo ".... 5 ";
echo ".... 6 ";
echo ".... 7 ";


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


Reply to discussion (solution)

Don't understand, oh oh

This is not much, see what you used to use.

Form 2 requires variable caching, not high natural efficiency
But at all times, efficiency obeys the task.

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

The first kind of course.
Str splicing, is more efficient and memory

OK
Echo ' ... a ', ' ... b ', ' ... c '//This way

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.