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