Home >Backend Development >PHP Tutorial >php中$this->name和$this->$name有什么区别?

php中$this->name和$this->$name有什么区别?

PHPz
PHPzOriginal
2016-06-06 20:51:551835browse

php中$this->name和$this->$name有什么区别?

php中$this->name和$this->$name有什么区别?

可以搜索了解PHP的可变变量。

// 这是访问对象中名为$name的变量
$this->name 
// 这是访问对象中的可变变量,你可以理解成动态变量,变量名由$name的值决定
$this->$name

更多相关技术文章,请访问PHP中文网

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