Home > Backend Development > PHP Tutorial > 求问php echo 字符串输出的效率问题?

求问php echo 字符串输出的效率问题?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-23 14:13:36
Original
1013 people have browsed it

想知道以下两种执行形式,哪种效率更高,或是有更高的方法!!!
输出形式1
echo "....2";
echo "....3";
echo "....4";
echo "....5";
echo "....6";
echo "....7";


输出形式2
$str.="....2";
$str.="....3";
$str.="....4";
$str.="....5";
$str.="....6";
$str.="....7";
echo $str;


回复讨论(解决方案)

看不懂,呵呵呵

这个差不了多少吧,看你习惯用哪种。

形式2需要用变量缓存,自然效率不高
但任何时候都是效率服从任务的

 参考这里计算执行的时间
http://blog.csdn.net/php_boy/article/details/6450678

当然 是第一种了。
str拼接,是比较耗效率和内存的

可以
echo '...a','...b','...c'//这个方式

1
效率 高

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template