Object that has "-" in object name, please help

Discussion in 'PHP' started by smilesquare, Oct 24, 2007.

  1. #1
    when I try to access data in the object

    echo $myxml->aaa-list; // return 0 "incorrect"



    I have to use

    $mylist = "aaa-list";
    echo $myxml->$mylist; // return correct result


    How can I correct this line to get the answer?
    echo $myxml->aaa-list;


    Thank you.
     
    smilesquare, Oct 24, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    $myxml->{'aaa-list'};
     
    nico_swd, Oct 24, 2007 IP