What is the explanation for the following syntax?
$var1->$var2 // Note the second $
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;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With