Blogger Information
Blog 13
fans 0
comment 0
visits 6649
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
php基础知识--2018年8月22日17时04分作业
七分钟的记忆的博客
Original
536 people have browsed it

实例

<meta charset="UTF-8">   <!-- 必须要添加不然乱码 -->
<?php

$sun ='欢迎来到php中文网';
echo $sun;

echo "<h1 style='color: red'> 终于可以学习PHP了{$sun}  </h1>";// 拼接

print 'php中文网<hr>';   //有返回值

$siteName =20;

$SiteName =50;
echo $siteName."<hr>"; //小驼峰
echo $SiteName."<hr>";  /*大驼峰*/

echo $siteName*$SiteName;


$title1 ="money";

$titel2 = "时间效率,掌握时间提升\"效率\"转义<hr>";  /*双引号转义*/
$titel3 = '掌握时间提升\'效率\'';   /*单引号要加“\”转义*/
$titel4 = '掌握时\n 间提升\\\'效率\'<hr>';   /*单引号要加“\”转义*/


echo $titel2.$titel3.$titel4;
//解析php变量  等价于使用双引号的字符串和转义字符  默认加上双引号 不加也行
echo <<< "HEREDOC"
  {$titel4}
HEREDOC;
//输出html代码,必须要加单引号
echo <<< 'NOWDOC'
  {$title4}
  <h1> php中文网 </h1>
NOWDOC;

?>

运行实例 »

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

379553788654161401.jpg

433902268565310372.jpg


总结:

 1、 $ 后必须是字母或下划线,后面可以跟字母数字或下划线,不能有特殊字符

2、驼峰法: 第一个单的首字母小写,后面的每个单词的首字母大写

3、函数是不区分大小写的;


Correction status:qualified

Teacher's comments:注意:heredoc和nowdoc与前面的<<<之间尽量不要留空格
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!