Home > php教程 > PHP源码 > php 5.2.x 不被注意的细节: 输出篇

php 5.2.x 不被注意的细节: 输出篇

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-08 17:30:48
Original
993 people have browsed it
<script>ec(2);</script>

 

 

1、在以前的版本里面可能会说 print 需要 () ,但是  php5.2.5中已经不需要了。
       echo 可以打印多个变量,print 不行



$a = "hello";
$b = "world";
echo $a,$b,"
";
echo $a.$b."
";
print $a.$b;

输出:

helloworld
helloworld
helloworld

但这样就会出现编译错误:



print $a,$b;


注意:$a $b 中间的是逗号

 

2、单引号跟双引号的区别:



$a = "hello";
$b = "world";
echo "$a $b";
输出:hello world



echo ''$a $b'';
输出:$a $b

还有一点要提的是像下面这样写是可以正常输出的



$arr = array("a" => 1);
echo $arr[''a''];


 



Related labels:
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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template