php print
php print
定义和用法
print() 函数输出一个或多个字符串。
语法
print(strings)
参数 描述
strings 必需。发送到输出的一个或多个字符串。
提示和注释
注释:print() 函数实际上不是函数,所以您不必对它使用括号。
注释:print() 函数稍慢于 echo()。
例子 1
<?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!
例子 2
<?php
print "This text spans multiple lines.";
?>输出:
This text spans multiple lines.
例子 3
<?php
$color = "red";
print "Roses are $color";
print "<br />";
print ''Roses are $color'';
?>输出:
Roses are red Roses are $colorPHP String 函数