print()
PHP中的函数输出一个或多个字符串。
注意 -该print()
方法慢于echo()
print(arg)
arg-输入数据
该print()
函数始终返回1。
以下是一个例子-
<?php $s = "This is demo text!"; print $s; ?>
输出结果
This is demo text!
以下是一个例子-
<?php $one = "Java is a programming language!"; $two = "James Gosling developed Java!"; $three = "Current version of Java is Java SE 11!"; print $one . " " . $two . " " .$three; ?>
输出结果
Java is a programming language! James Gosling developed Java! Current version of Java is Java SE 11!
以下是一个例子-
<?php print "This is a demo text in multiple lines."; ?>
输出结果
This is a demo text in multiple lines.