How do I access a PHP object attribute having a dollar sign?
oop, php
Solution
With variable variables:
$myVar = 'variable$WithDollar';
echo $object->$myVar;
With curly brackets:
echo $object->{'variable$WithDollar'};
Problem
I have a PHP Object with an attribute having a dollar ($) sign in it. How do I access the content of this attribute ? Example : ``` echo $object->variable; // Ok echo $object->variable$WithDollar; // Syntax error :-( ```