您的位置:首页 > 其它

echo和print的区别

2016-05-07 13:43 169 查看
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=的还就会报语法错误
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: