45 lines
1.0 KiB
Markdown
45 lines
1.0 KiB
Markdown
---
|
||
title: Basic Syntax
|
||
localeTitle: 基本语法
|
||
---
|
||
# 基本语法
|
||
|
||
PHP脚本可以放在文档中的任何位置。
|
||
|
||
PHP脚本以`<?php`开头,以`?>`结尾
|
||
|
||
下面,我们有一个简单的PHP文件示例,其中一个PHP脚本使用内置的PHP函数“echo”来输出文本“Hello World!”。在网页上
|
||
|
||
\`\`\`\`
|
||
|
||
# 我的第一个PHP页面
|
||
```
|
||
The output of that would be :
|
||
```
|
||
|
||
我的第一个PHP页面
|
||
|
||
你好,世界!
|
||
```
|
||
#### Note: PHP statements end with a semicolon (;).
|
||
|
||
# Comments in PHP
|
||
|
||
PHP supports several ways of commenting:
|
||
```
|
||
|
||
```
|
||
# PHP Case Sensitivity
|
||
|
||
In PHP, all keywords (eg if, else, while, echo, etc.), classes, functions, and user-defined functions are NOT case-sensitive.
|
||
|
||
In the example below, all three echo statements below are legal (and equal):
|
||
```
|
||
|
||
```
|
||
### However; all variable names are case-sensitive.
|
||
|
||
In the example below, only the first statement will display the value of the $color variable (this is because $color, $COLOR, and $coLOR are treated as three different variables):
|
||
```
|
||
|
||
\`\`\`\` |