echo和print的区别

1、echo可以同时输出多个字符串;

echo 'this',' string',' is'," hello world\n";

2、print有返回值,但是运行速度上echo比较快;

$str='Hello World';
$a=print "This is a string $str\n";
var_dump($a);

  输出结果:

This is a string Hello World
int(1)

  如果在echo的前面加一个$a=的还就会报语法错误

posted @ 2016-05-07 13:43  冠king  阅读(216)  评论(0编辑  收藏  举报