-
11月04日
-
【函数功能】
该函数输出一个或多个字符串。
【函数语法】
void echo ( string $arg1 [, string $... ] )
【参数说明】
$strings:必需,一个或多个要输出的字符串。
【演示程序】
<?php /** * echo ( string $arg1 [, string $... ] ) * **/ $a = 'hello '; $b = 'i am '; $c = 'PHP!'; echo $a,$b,$c; echo '<br>'."hello i am $c".'<br>'; $str = array('key'=>'PHP!'); echo "hello i am $str[key]"; echo '<br>'."hello i am {$str['key']}"; ?>
【输出结果】
hello i am PHP! hello i am PHP! hello i am PHP! hello i am PHP!
【特别注意】
1.echo() 函数实际不是一个函数,所以您不必对它使用括号。然而,如果您希望向 echo() 传递一个以上的参数,使用括号将会生成解析错误。 2.echo() 函数比 print() 速度稍快。 3.echo() 函数也有简写语法。在 PHP 5.4.0 之前,该语法只适用于 short_open_tag 配置设置启用的情况。 4.PHP 版本:4+。
【原版定义】
Outputs all parameters. No additional newline is appended. echo is not actually a function (it is a language construct), so you are not required to use parentheses with it. echo (unlike some other language constructs) does not behave like a function, so it cannot always be used in the context of a function. Additionally, if you want to pass more than one parameter to echo, the parameters must not be enclosed within parentheses. echo also has a shortcut syntax, where you can immediately follow the opening tag with an equals sign. Prior to PHP 5.4.0, this short syntax only works with the short_open_tag configuration setting enabled.
转载请注明出处:php1234.cn ,原文地址:http://www.php1234.cn/a/functions/2016/1104/116.html
收藏文章

登录
表情删除后不可恢复,是否删除
取消
确定
图片正在上传,请稍后...
取消上传
评论内容为空!
还没有评论,快来抢沙发吧!
畅言云评
站长点击我去广告>
热评话题
- 德者,人之所得,使万物各得其所欲_PHP1234|PHP修炼之路|跟着明礼馨德一起修炼PHP
- 义者,人之所宜,赏善罚恶,以立功立事_PHP1234|PHP修炼之路|跟着明礼馨德一起修炼PHP
- 夫欲为人之本,不可无一焉_PHP1234|PHP修炼之路|跟着明礼馨德一起修炼PHP
- 潜居抱道,以待其时!_PHP1234|PHP修炼之路|跟着明礼馨德一起修炼PHP
- 极人臣之位;成绝代之功;如其不遇,没身而已_PHP1234|PHP修炼之路|跟着明礼馨德一起修炼PHP
- 明于盛衰之道,通乎成败之数;审乎治乱之事,_PHP1234|PHP修炼之路|跟着明礼馨德一起修炼PHP
- 仁者,人之所亲,有慈惠恻隐之心,以遂其生成_PHP1234|PHP修炼之路|跟着明礼馨德一起修炼PHP