PHP 打印数据:print 语句 1 个改进

Print#

print - 输出字符串

说明#

print ( string $arg) : int

输出 $argprint 实际上不是函数(而是语言结构),所以可以不用圆括号包围参数列表。不会换行。

printecho 的主要区别: print 只能输出一个参数,并总是返回 1。

返回值#

总是返回 1。

范例#

<?php
print("Hello World");

print "print() also works without parentheses.";

print "This spans
multiple lines. The newlines will be
output as well";

输出结果:

Hello Worldprint() also works without parentheses.This spans
multiple lines. The newlines will be
output as well
本文为 Wiki 文章,邀您参与纠错、纰漏和优化