Here’s a quick GOTCHA that may save at least one developer some time. Recently whilst working with some XML to import music into an mp3 download site I came across an issue accessing the values of specific nodes through the simplexml object that I created. The value always threw up zero.
The issue lies in node names containing hyphens, thus:
$object->album-title returns 0
The answer is to wrap the object property (node name) containing the hyphen in curly braces.
$object->{’album-title’} returns “London Calling”
Here’s hoping that helps someone.