News Feed
Sections
News Archive


Community Events






feed this:

Builder.com.au:
How do I...recursively scan directories with PHP's DirectoryIterators?
0 comments :: posted Wednesday June 18, 2008 @ 07:55:21
voice your opinion now!

Builder.com.au has a new tutorial posted today talking about the use if Iterators (from PHP's SPL) to recurse down through directories on your local drive.

One of PHP5's most interesting new features is the addition of Iterators, a collection of ready-made interfaces designed to help in navigating and processing hierarchical data structures. These Iterators significantly reduce the amount of code required to process an XML document tree or a file collection.

They give three examples - two basic ones showing a simple use of the DirectoryIterator and RecursiveDirectoryIterator and another slightly more complex one showing how to get information from the recursive iteration as it goes down.

tagged with: directoryiterator iterator recursive directory example code


Brian Moon's Blog:
Stupid PHP Tricks Normalizing SimpleXML Data
0 comments :: posted Tuesday June 03, 2008 @ 09:34:22
voice your opinion now!

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.

tagged with: trick stupid simplexml normalize json recursive empty tag


package PHP5 zend cakephp release zendframework PEAR developer database book pecl security ajax code job application releases conference framework mysql

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