PHP之print
来源:互联网 发布:数控铣床编程太阳图案 编辑:程序博客网 时间:2024/06/05 07:10
1.
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 spans\nmultiple lines. The newlines will be\noutput 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: 因为是一个语言构造器而不是一个函数,不能被 可变函数 调用。
print只能输出一个数字或字符串,而echo能输出多个。
阅读全文
0 0
- PHP之print
- php之echo print区别
- PHP 打印函数之 print print_r
- 初学PHP 之 echo/print 以及数据类型
- PHP之输出字符串(echo,print,print_r和var_dump)
- 初学php之echo print print_r var_dump的区别
- 三天上手PHP之3:输出方式(echo 和 print)
- PHP Echo Vs Print
- php print 函数
- PHP echo/print
- php面试题之PHP中echo和print有什么区别?
- 新手笔记之print(?)
- python之print实践
- python之print
- Python入门之print
- python之print语句
- Python之print
- Python之print语句
- 完全背包问题(动态规划(DP))
- hdu 6119 小小粉丝度度熊(尺取法)
- MATLAB中的常用清除命令有哪些?
- C++中的圓括號重載
- bookstrap 联想下拉框
- PHP之print
- HDU 1863 畅通工程【最小生成树】
- PHP 5 MySQLi 函数
- 2017 HDU 6103 多校联合赛 Kirinriki
- 关于do while与wihle循环和for循环之间的出入
- linux修复丢失的分区表
- String s = new String("xyz");创建了几个对象的问题?
- java字符串数组进行大小排序
- PHP 杂项 函数