Monthly Archives: July 2010

SimpleXMLElement attributes

Ya unless you work on PHP SimpleXML that title won’t make much sense. But if you do and you need to mess with SimpleXML as I have been lately to parse some Media RSS feeds you will need to use this function.

I was using it to store some urls in a drupal job queue and it was dropping in serialized SimpleXMLElement objects rather than urls.

If you go to the relevant PHP manual page you will find a comment that explains that you need to cast these attributes as string to get the value I was looking to store.

What was more interesting was Googling php SimpleXMLElement shows the solution on the second result as a summery.

Damn they are good.