freeCodeCamp/guide/chinese/php/basic-syntax/index.md

45 lines
1.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

---
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):
```
\`\`\`\`