print() 函数输出一个或多个字符串。
print(strings)
参数 描述
strings 必需。发送到输出的一个或多个字符串。
注释:print() 函数实际上不是函数,所以您不必对它使用括号。
注释:print() 函数稍慢于 echo()。
<?php
$str = "Who's John Adams?";
print $str;
print "<br />";
print $str."<br />I don't know!";
?>输出:
Who's John Adams? Who's John Adams? I don't know!
<?php
print "This text spans multiple lines.";
?>输出:
This text spans multiple lines.
<?php
$color = "red";
print "Roses are $color";
print "<br />";
print 'Roses are $color';
?>输出:
Roses are red Roses are $colorPHP String 函数