Correction status:qualified
Teacher's comments:heredoc和nowdoc跟前面的<<<中间不需要有空格,下次注意了!
<meta charset="utf-8"> <?php $money = '95亿美元'; $titile = '阿里'.$money.'收购饿了么'; echo $titile; $titile1 = '阿里'.$money.'收购\'饿了么\''; echo '<br>'.$titile1; $titile2 = "阿里{$money}收购\"饿了么\""; echo '<br>'.$titile2; $titile3 = "阿里{$money}收购\\\"饿了么\\\""; echo '<br>'.$titile3; //heardoc //heardoc 邓嘉与使用了双引号的字符串中,可以解析内部的变量和转义特殊字符 $heardoc = <<< HEARDOC $titile2 HEARDOC; //nowdoc //相当于用单引号包装的字符串 echo <<< 'NOWDOC' <h3><a href ="#"> hello,哈撒及啊</a></h3> NOWDOC; ?>
点击 "运行实例" 按钮查看在线实例
emm,这算是php初识的一点练习把,要注意的是变量的命名规范和命名的方法规则
理论知识还是要有的,不过实践出真知嘛。