How to access object properties with names like integers?

后端 未结 7 943
故里飘歌
故里飘歌 2020-11-21 22:14

I am using json_decode() something like:

$myVar = json_decode($data)

Which gives me output like this:

[highlig         


        
相关标签:
7条回答
  • 2020-11-21 23:11

    I'm afraid you aren't allowed to name objects starting with numerics. Rename the first one "448364" starting with a letter.

    The second one is an array, those are to be accessed by brackets like so:

    print myVar->highlighting->test_448364->Data[0]
    

    instead

    0 讨论(0)
提交回复
热议问题