$this->name和$this->$name的区别,小弟我糊涂了

WBOY
Release: 2016-06-13 10:42:36
Original
868 people have browsed it

$this->name和$this->$name的区别,我糊涂了!
在set和get方法中使用的是$this->$name,我一看就蒙了,平时给属性赋值$this->name='sss'; 求详细介绍和解释!!!!!

------解决方案--------------------
后者是变量
前者是变量的变量
------解决方案--------------------
$name=aaa;
$this->$name 等於 $this->aaa;
$this->aaa是類變量
------解决方案--------------------

PHP code
class a{ private $name; $this->name; private $$name; $this->$name;}
Copy after login
Related labels:
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!