Blogger Information
Blog 18
fans 0
comment 0
visits 9286
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
变量---4月12号
学习不刻苦 不如卖红薯
Original
436 people have browsed it

变量,双引号单引号,HEREDOW,NOWDOC

实例

<meta charset="utf-8">
<?php
header("Content-type:text/html;charset=utf-8");
 //1.创建变量
$money = '95亿美金';
//双引号解析变量,单引号不解析变量
$title = '阿里$money收购了饿了么';
$title2 = "阿里{$money}收购了饿了么";

echo $title;
echo '<br>';
echo $title2;

echo '<hr>';
//反斜线
echo '郭德纲:\'你无耻的样子很有我当年的神韵。\'';
echo '<br>';
echo "郭德纲:\"你无耻的样子很有我当年的神韵。\"";
echo '<br>';
echo '郭德纲:"你无耻的样子很有我当年的神韵。"';

echo '<br>';
//nl2br
echo nl2br("明天会下雨吗? \n 不会的");
echo '<hr>';
$siteName = 'php中文网';
echo "欢迎来到{$siteName}";
echo '<br>';
echo "欢迎来到{\$siteName}";

//HEREDOC
echo '<br>';
$siteName = <<<HEREDOC
{$siteName}致力于打造一站式免费学习平台,誓将"公益"进行到底!\n
这里是PHP爱好者共同的家园,我们热忱欢迎来自全国各地的PHP爱好者~~
HEREDOC;
echo $siteName;
echo '<br>';
echo nl2br($siteName);
echo '<br>';
$nowdoc = <<< 'NOWDOC'
	<h3>$siteName</h3> \r\n 'www.php.cn'
NOWDOC;

echo '<hr>';
echo $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