返回值: | 始终返回 1。 |
PHP 版本: | 4+ |
输出字符串变量($str)的值:
</>code
- <?php
- $str = "I love Shanghai!";
- print $str;
- ?>
输出字符串变量($str)的值,包含 HTML 标签:
</>code
- <?php
- $str = "I love Shanghai!";
- print $str;
- print "<br>What a nice day!";
- ?>
连接两个字符串变量:
</>code
- <?php
- $str1 = "I love Shanghai!";
- $str2="What a nice day!";
- print $str1 . " " . $str2;
- ?>
输出数组的值:
</>code
- <?php
- $age=array("Bill"=>"60");
- print "Bill Gates is " . $age['Bill'] . " years old.";
- ?>
输出文本:
</>code
- <?php
- print "This text
- spans multiple
- lines.";
- ?>
单引号和双引号的区别。单引号将输出变量名称,而不是值:
</>code
- <?php
- $color = "red";
- print "Roses are $color";
- print "<br>";
- print 'Roses are $color';
- ?>
如对本文有疑问,请提交到交流论坛,广大热心网友会为你解答!! 点击进入论坛
Powered by 365建站网 RSS地图 HTML地图
copyright © 2013-2024 版权所有 鄂ICP备17013400号