PHP 打印数据:print 语句
print
- 输出字符串
说明
print ( string $arg) : int
输出 $arg
。print
实际上不是函数(而是语言结构),所以可以不用圆括号包围参数列表。不会换行。
print
和 echo
的主要区别: 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