收藏本站 收藏本站
积木网首页 - 软件测试 - 常用手册 - 站长工具 - 技术社区
首页 > PHP > PHP字符串函数 > 正文

首页 - PHP - 数据库 - 操作系统 - 游戏开发 - JS - Android - MySql - Redis - MongoDB - Win8 - Shell编程 - DOS命令 - jQuery - CSS样式 - Python - Perl

Access - Oracle - DB2 - SQLServer - MsSql2008 - MsSql2005 - Sqlite - PostgreSQL - node.js - extjs - JavaScript vbs - Powershell - Ruby

PHP技巧 - PHP基础 - PHP实例 - PHP字符串 - PHP数据库函数 - Mysql函数 - PDO类库 - PHP错误处理 - PHP选项 - PHP函数库 - PHP数学函数 - PHP数组

PHP字符串函数print()的用法

print

(PHP 4, PHP 5)

print — 输出字符串

说明

int print ( string $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

本周排行

更新排行

强悍的草根IT技术社区,这里应该有您想要的!
Copyright © 2010 Gimoo.Net. All Rights Rreserved  京ICP备05050695号