Home  >  Article  >  Backend Development  >  php中print跟echo的区别,以及“”,‘’的区别

php中print跟echo的区别,以及“”,‘’的区别

WBOY
WBOYOriginal
2016-06-13 10:54:32807browse

php中print和echo的区别,以及“”,‘’的区别

在 echo 函数中,可以同时输出多个字符串,而在 print 函数中则只可以同时输出一个字符串。同时,echo函数并不需要圆括号,所以echo函数更像是语句而不像是函数。
$a="hello";
$b="world";
echo "a","b";
print "a","b";
?>
中的print"a","b";这句话就是错的,只有echo这函数可以这样写.

---单引号串和双引号串在PHP中的处理是不相同的。双引号串中的内容可以被解释而且替换,而单引号串中的内容总被认为是普通字符。
若$value = "我是value值";
echo“$value”;----- ?输出的是:我是value值
echo‘$value’;----- ?输出的是:$value

PHP的标识,和PHP的注释:
. . . ?>

------------------------------------------------
PHP中的注释有很多种
/* ? */
//
#

Statement:
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
Previous article:php关于zip的应用Next article:PHP编码变换类3