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

PHPz
Release: 2020-06-23 09:49:46
Original
1768 people have browsed it

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

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

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

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

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

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!