How do I access a PHP object attribute having a dollar sign?

后端 未结 5 2121
清歌不尽
清歌不尽 2020-11-29 12:17

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-         


        
5条回答
  •  被撕碎了的回忆
    2020-11-29 12:47

    Thanks to your answers, I just found out how I can do that the way I intended :

    echo $object->{'variable$WithDollar'}; // works !
    

    I was pretty sure I tried every combination possible before.

提交回复
热议问题