PHP学习笔记 04 - 输出

输出语句

  • PHP输出语句:echoprint
  • echoprint 后面可以加也可以不加小括号 (()
  • 不同:
    • echo 没有返回值;print 返回 1
    • echo 接受多个参数;print 只接受一个参数
    • echoprint 执行稍快

示例

<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
    <title>Hello World!</title>
</head>

<body>
    <div class="jumbotron">
    <?php
    echo("<h2>Learning PHP</h2>");
    print("<blockquote>");
    $newline = "<br>";
    echo "PHP is a popular general-purpose scripting language ", 
         "that is especially suited to web development.", "$newline";
    print "Fast, flexible and pragmatic, PHP powers everything from your blog to the most popular websites in the world.";
    print "</blockquote>";
    ?>
    </div>
</body>

</html>

查看运行结果

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值