Home  >  Article  >  php教程  >  PHP中的变量,PHP变量

PHP中的变量,PHP变量

WBOY
WBOYOriginal
2016-06-13 08:43:02891browse

PHP中的变量,PHP变量

PHP中的变量

    程序是由代码与数据两部分组成,数据存储在变量,变量的本质是内存中的一个存储空间。变量对应的空间有一个名子,叫变量名,变量名用于对数据进行读写。

变量的定义

在php变量名之前必须使用'$'符号,也可以理解为'$'就是定义变量的语法结构

示例:

变量的访问

echo 变量名;

示例:

变量的修改

变量名=值;

变量的删除

unset(变量名);

示例:

 

变量的命名规范:

1、必须以'$'开头

2、只能包含字母、数字、下划线

3、'$'符号后不能以数字开头

Statement:
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