Understanding of PHP's four markup styles

陈政宽~
Release: 2023-03-11 17:24:01
Original
2516 people have browsed it

PHP4种标记风格

1.XML风格

<?php
echo "这是XML风格标记";
?>
Copy after login

2.脚本风格

<script language="php">
echo "这是脚本风格标记";
</script>
Copy after login

3.简短风格

<?
echo "这是简短风格标记";
?>
Copy after login

4.ASP风格

<%
echo "这是ASP风格标记";
%>
Copy after login

注释

单行: //

多行: /*…………*/

标量数据类型

boolean(布尔型) :只有2个值,真(true)和假(false)

string(字符串型):连续的字符串序列

integer(整型):只包含整数

float(浮点型):实数

$是标量的标识符,所有变量都是以$符号开头

3种定义字符串的方式

1.单引号( ' )

<?php
$a=&#39;字符串&#39;;
?>
Copy after login

2.双引号( " )

<?php
$a="字符串";
?>
Copy after login

3.界定符( <<< )

<?php
$string=<<<str
字符串
str    //结束界定符必须另起一行
?>
Copy after login

单引号和双引号的区别:单引号是按普通字符输出,双引号是包含的变量会替换替换成实际数值

转义字符输出多加“\”

如:

<?php
$a="字符串";
echo "\$a";
echo "$a";
?>
Copy after login

输出结果:$a

字符的连接(和JAVA类似(JAVA里是+,这里是.))

如:

<?php
$a="word";
echo "hello".$a;
?>
Copy after login

输出结果:hello word


The above is the detailed content of Understanding of PHP's four markup styles. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!