Sunday, January 13, 2019

What does the PHP syntax $var1->$var2 mean?



What is the explanation for the following syntax?




$var1->$var2 // Note the second $

Answer



You are calling a property on $var1 that is named the same as the value of $var2.



For example:



$var2 = "name";


// The following are equivalent
$var1->name;
$var1->$var2;

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...