Files
freeCodeCamp/guide/chinese/php/PHP Variables/index.md
2018-10-16 21:32:40 +05:30

18 lines
894 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: PHP Variables
localeTitle: PHP变量
---
### PHP- Vaiables类型
Varibles是以PHP程序的中间方式存储信息的主要方式。 PHP中的所有变量都使用`$variable_name`等前导美元符号进行捐赠。 变量分配有`= operator` ,左侧是变量,右侧是要计算的表达式。
### 变量命名
命名变量的规则如下: -
1. 变量名称必须以字母或下划线字符开头。 2.变量名可以由数字,字母,下划线组成,但不能使用`+ , - , % , ( , ) . &`类的字符`+ , - , % , ( , ) . &`以它的名字。 3. `($age and $AGE are two different variables)`名称区分大小写,即`($age and $AGE are two different variables)`
### 创建声明PHP变量
在PHP中变量以$符号开头,后跟变量名称。下面给出的代码片段显示了它。
`shell <?php $txt = "Hello world!"; $x = 6; $y = 10.5; ?>`