I know we should avoid "-" characters in xml tag name. But I need to parse a 3rd party xml with "-" characters in xml tag name.
I am trying to use simplexml to read xml data like this
<questions>
<question>
<created-at type="datetime">2008-11-20T15:31:01-05:00</created-at>
</question>
<questions>
So my simplexml code is
$question_xml = new SimpleXMLElement('http://www.mysite.com/mydoc.xml', NULL, TRUE);
foreach($question_xml->question as $question)
{
$question['created_at'] = $question ->created-at;
}
The problem is
$question ->created-at
is not a valid name.
How do you refer to the member variable with the name like "create-at"?
Thanks!