【函数功能】
该函数输出一个或多个字符串,该函数和echo函数一样,不是真正的函数,使用时可不用双括号,也无返回值。
【函数语法】
int print ( string $arg )
【参数说明】
$arg:必需,发送到输出的一个或多个字符串。
【演示程序】
<?php
/**
* int print ( string $arg )
* **/
$str = "hello i am PHP!";
print $str;
print '<br>';
print "$str";
print '<br>';
print '$str';
?>
【输出结果】
hello i am PHP!
hello i am PHP!
$str
【特别注意】
1.print() 函数比 echo() 稍慢。
2.print函数和echo函数有一个小小的区别:echo可以输出多个变量,中间用逗号隔开,而print不能。
3.PHP 版本:4+。
【原版定义】
/**
print is not actually a real function (it is a language construct) so you are not required to use parentheses with its argument list.
The only difference to echo is that print only accepts a single argument.
**/
转载请注明出处:php1234.cn ,原文地址:http://www.php1234.cn/a/functions/2016/1108/124.html