Possible Duplicate:
SimpleXML Reading node with a hyphenated name
I am pulling some data for a gaming tournament through an API on this page - http://www.sandwichmuffin.com/muffinleague/
I have been able to access some of the properties seen in the output of the print_r function, for example, to echo the tournament name I simply used
echo $tournaments->tournament[0]->name;
However I am having difficulty doing the same for the 'description-source'. Is there a different way to go about echoing this particular property? Pretty much everything I've tried has resulted in a 0, or false, by my understanding.
Edit: They claim that this (http://challonge.com/api/tournaments) is the format of the XML returned from my API query, if that helps.
$tournaments->tournament[0]->{"description-source"}
You can't have a minus/hyphen in a property name. Try:
$descriptionSource = 'description-source';
echo $tournaments->tournament[0]->$descriptionSource;
Hope this helps :)
EDIT
Clarification: you can't have a minus/hyphen in a property name without escaping it (as shown in the other answers) or assigning the property name to a variable (as shown in my example).
"description-source" is not legal php method name, so you can call like this
echo $tournaments->tournament[0]->{"description-source"};