Blogger Information
Blog 10
fans 0
comment 0
visits 5739
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
PHP环境搭建与基本语法2018年8月21日20时00分
疯狂石头的博客
Original
439 people have browsed it

Snipaste_2018-08-24_16-01-01.png

实例

<?php
/**
 * Created by PhpStorm.
 * User: 714326675
 * Date: 2018/8/22
 * Time: 15:38
 */
//字符串
$name='腾讯公司';
$theCase='市值\'暴跌\'12000亿港币';
$theCase2="{$name}市值暴跌12000\\\"亿港币\"";

echo $name,'<br>',$theCase,'<br>';
echo $theCase2;
echo '<hr>';

//heredoc
//heredoc 等价使用了双引号的字符中,可以解析内部的变量和转义特殊字符 写的时候可以不加,因为默认的加的
echo <<< "HEREDOC"
{$name} \n \r \t
HEREDOC;

//nowdoc
//nowdoc 相当于单引号包装的字符串 写的时候必须加单引号】
//不能解析变量的,只能解析html
echo <<<'NOWDOC'

<h3 style="color:blue;">马老板</h3>
NOWDOC;

运行实例 »

点击 "运行实例" 按钮查看在线实例


Correction status:qualified

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post