(PHP 4, PHP 5)
print — 输出字符串
$arg
)
输出 arg
。
print 实际上不是一个函数(它是一个语言结构),因此你可以不必使用圆括号来括起它的参数列表。
arg
输入数据。
总是返回 1。
Example #1 print 范例
<?php
print("Hello World");
print "print() also works without parentheses.";
print "This spans
multiple lines. The newlines will be
output as well";
print "This spansnmultiple lines. The newlines will benoutput as well.";
print "escaping characters is done "Like this".";
// 可以在打印语句中使用变量
$foo = "foobar";
$bar = "barbaz";
print "foo is $foo"; // foo is foobar
// 也可以使用数组
$bar = array("value" => "foo");
print "this is {$bar['value']} !"; // this is foo !
// 使用单引号将打印变量名,而不是变量的值
print 'foo is $foo'; // foo is $foo
// 如果没有使用任何其他字符,可以仅打印变量
print $foo; // foobar
print <<<END
This uses the "here document" syntax to output
multiple lines with $variable interpolation. Note
that the here document terminator must appear on a
line with just a semicolon no extra whitespace!
END;
?>
Note: 因为是一个语言构造器而不是一个函数,不能被 可变函数 调用。
echo - 输出一个或多个字符串 printf() - 输出格式化字符串 flush() - 刷新输出缓冲 Heredoc syntax
PHP字符串函数ord()的用法
ord(PHP4,PHP5)ord返回字符的ASCII码值说明intord(string$string)返回字符串string第一个字符的ASCII码值。该函数是chr()的互补函数。参数string一个字符。返回值返回
PHP字符串函数money_format()的用法
money_format(PHP4=4.3.0,PHP5)money_formatFormatsanumberasacurrencystring说明stringmoney_format(string$format,float$number)money_format()returnsaformattedversionofnumber.ThisfunctionwrapstheClibraryf
PHP字符串函数nl2br()的用法
nl2br(PHP4,PHP5)nl2br在字符串所有新行之前插入HTML换行标记说明stringnl2br(string$string[,bool$is_xhtml=true])在字符串string所有新行之前插入br/或br,并返回。参数str