News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

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

Paul Jones' Blog: Solar 0.27.0 and 0.27.1 Released

Gaetano Giunta's Blog: A completely fair and balanced comparison of php json libraries

Abou Kone's Blog: Set up JSON action output in CakePHP 1.3

WeberDev.com: PHP 101 (part 11) - Sinfully Simple (SimpleXML)

Joshua Eichorn's Blog: Understanding AJAX Digital Shortcut Available


Community Events





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


list podcast framework code tips development release language developer application threedevsandamaybe introduction conference deployment laravel zendserver interview community series api

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