PHP语法$ var1-> $ var2是什么意思? [英] What does the PHP syntax $var1->$var2 mean?
本文介绍了PHP语法$ var1-> $ var2是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下语法的解释是什么?
What is the explanation for the following syntax?
$var1->$var2 // Note the second $
推荐答案
您正在$var1
上调用一个属性,该属性的名称与$var2
的值相同.
You are calling a property on $var1
that is named the same as the value of $var2
.
例如:
$var2 = "name";
// The following are equivalent
$var1->name;
$var1->$var2;
这篇关于PHP语法$ var1-> $ var2是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文