This entry was posted on Monday, April 12th, 2010 at 12:01 pm and is filed under Tech Stuff. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
Just came across a bit of a time-waster in the PHP SimpleXMLElement lib. Usually if you’re accessing an element called, say ‘username’ you use the follwoing syntax:
$username = $element->username;
However if the element has a minus sign in its name, like ‘user-name’ you have to use the following syntax instead:
$username = $element->{’user-name’};
If you use the original syntax no data will be returned, mad stuff, I would have wasted much more time on this if it wasn’t for this post - Thanks for the dig-out!
