News Feed
Jobs Feed
Sections




News Archive
Brian Moon's Blog:
Stupid PHP Tricks Normalizing SimpleXML Data
June 03, 2008 @ 09:34:22

Brian Moon has a "stupid PHP trick" posted to his blog today - normalizing SimpleXML data you've pulled in from just about any external source.

Anyhow, one annoying thing about SimpleXML has to do with caching. When using web services, we often cache the contents we get back. We were having a problem where we would get an error about a SimpleXML node not existing.

They were using memcache to store the information but came across problems when their code tried to use a (sometimes) empty tag. He gives two solutions - one using a recursive function that identifies the empty items and the other that encodes then decodes the object to and from JSON, keeping the values intact.

0 comments voice your opinion now!
trick stupid simplexml normalize json recursive empty tag


blog comments powered by Disqus

Similar Posts

Lukas Smith's Blog: Lets talk about JSON in Symfony2

Brian Moon's Blog: Stupid PHP Tricks: Normalizing SimpleXML Data

Douglas Clifton's Blog: PHP/Ajax Integration

Bob Majdak: Apache access logging in JSON format

EasyPHPWebsites.com: Gluing jQuery and PHP Together with JSON


Community Events











Don't see your event here?
Let us know!


conference introduction framework opinion development testing podcast community unittest series usergroup zendframework2 release symfony2 rest functional language interview phpunit database

All content copyright, 2013 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework