看到一篇文章說明那一個比較快~
結果,理所當然由echo勝出!echo快print一點點(也比較方便嘛)
(不然怎麼一堆人都在用它)
文章當中指出數個不同之處:
- print是一個function(函數)
- print是有precedence的
- echo可以吃數個parameter;
print只可以吃一個;echo "and a ", 1, 2, 3; // comma-separated without parentheses echo ("and a 123"); // just one parameter with parentheses print() can only take one parameter: print ("and a 123"); print "and a 123";
source: http://www.faqts.com/knowledge_base/view.phtml/aid/1/fid/40