Correction status:qualified
Teacher's comments:
<?php //字符串 $grade1 = '95'; $grade2 = '80'; $grade3 = '76'; $title1 = '小明今天数学考试得了'.$grade1.'分'; $title2 = '小明今天数学考试得了\'$grade2分\''; $title3 = "小明今天数学考试得了{$grade3}\\\"分\""; echo $title1, '<br>', $title2, '<br>'; echo nl2br($title3); echo '<hr>'; //heredoc // heredoc 等价使用了双引号的字符中,可以解析内部的变量和转义特殊字符 echo <<< "HEREDOC" {$title2} \n \r \t 这和双引号没什么区别,可以直接输出出来 HEREDOC; echo '<hr>'; // nowdoc // 相当于用单引号包装的字符串 echo <<< 'NOWDOC' {$title2} \n \r \t <h3><a href="">Hello 同学们晚上好呀</a></h3> NOWDOC;
点击 "运行实例" 按钮查看在线实例