<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Mon, 06 Oct 2008 11:12:15 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Builder.com.au: How do I...recursively scan directories with PHP's DirectoryIterators?]]></title>
      <guid>http://www.phpdeveloper.org/news/10430</guid>
      <link>http://www.phpdeveloper.org/news/10430</link>
      <description><![CDATA[<p>
Builder.com.au has a <a href="http://www.builderau.com.au/program/php/soa/How-do-I-recursively-scan-directories-with-PHP-s-DirectoryIterators-/0,339028448,339289935,00.htm?feed=rss">new tutorial</a> posted today talking about the use if Iterators (from PHP's SPL) to recurse down through directories on your local drive.
</p>
<blockquote>
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.
</blockquote>
<p>
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.
</p>]]></description>
      <pubDate>Wed, 18 Jun 2008 07:55:21 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Brian Moon's Blog: Stupid PHP Tricks: Normalizing SimpleXML Data]]></title>
      <guid>http://www.phpdeveloper.org/news/10328</guid>
      <link>http://www.phpdeveloper.org/news/10328</link>
      <description><![CDATA[<p>
<i>Brian Moon</i> has a "stupid PHP trick" posted to his blog today - <a href="http://brian.moonspot.net/2008/06/03/stupid-php-tricks-normalizing-simplexml-data/">normalizing SimpleXML data</a> you've pulled in from just about any external source.
</p>
<blockquote>
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.
</blockquote>
<p>
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.
</p>]]></description>
      <pubDate>Tue, 03 Jun 2008 09:34:22 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Richard Lord's Blog: PHP 5.2 - Nesting level too deep - recursive dependency?]]></title>
      <guid>http://www.phpdeveloper.org/news/6691</guid>
      <link>http://www.phpdeveloper.org/news/6691</link>
      <description><![CDATA[<p>
So, you've just upgraded to <a href="http://www.php.net/downloads.php">PHP 5.2</a> and all is going well until you come across a page in your application that gives the message "Nesting level too deep - recursive dependency?". With such a vague error message, you might have trouble locating the source of the problem. Thankfully, someone's already been there and <a href="http://www.bigroom.co.uk/blog/php-nesting-level-too-deep-recursive-dependency/">figured out the issue</a> - <i>Richard Lord</i>.
</p>
<blockquote>
I installed PHP 5.2 on one of my testing servers today and a couple of bits of code that previously worked fine in version 5.1.6 threw fatal errors in the new version. The error message was "Nesting level too deep - recursive dependency?" and it took a little time to track down the root of the problem. Here's what I'd done wrong.
</blockquote>
<p>
Basically, his problem was using the "non-strict" evaluation for checking if two objects were equal to each other (== instead of ===). This compares everything about them, down to the properties - even if they're references to other properties inside of the same class (which is where the problem lies).
</p>
<p>
So, the fix is simple - === instead of == when comparing those objects. You'll be happier for the change.
</p>]]></description>
      <pubDate>Mon, 13 Nov 2006 10:02:00 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Builder.com: Search and map directory trees with ease using the right PHP class]]></title>
      <guid>http://www.phpdeveloper.org/news/5669</guid>
      <link>http://www.phpdeveloper.org/news/5669</link>
      <description><![CDATA[<p>
In <a href="http://builder.com.com/5100-6371_14-6086917.html?part=rss&subj=bldr">this new tutorial</a> from Builder.com today, they take file searing (on the local machine) to the next level and illustrate the use of the PEAR <a href="http://pear.php.net/package/File_Find">File_Find</a> package.
</p>
<blockquote>
[But] recursive functions are complex, messy things and most developers (including myself) don't really enjoy working with them. That's why, when my last project needed to scan a directory hierarchy for a particular file (a typical recursive-function task), I didn't even consider rolling my own code. Instead, I headed straight for PEAR and its <a href="http://pear.php.net/package/File_Find">File_Find</a> class, which takes all the pain out of searching multi-level directory structures.
</blockquote>
<p>
You'll need to have worked with PEAR before, as there's no installation instructions, but pulling it in and getting it working from there is a breeze. They <a href="http://builder.com.com/5100-6371_14-6086917.html?part=rss&subj=bldr">include the code examples</a> that you'll need to follow along, showing how to create the object, what the object's "tree" of files looks like (recursively too!), and how to send the object off searching for a particular file as defined with a perl-compatible regular expression.
</p>]]></description>
      <pubDate>Fri, 23 Jun 2006 07:47:12 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Matthew Weir O'Phinney's Blog: Automating PHPUnit2 with SPL]]></title>
      <guid>http://www.phpdeveloper.org/news/5133</guid>
      <link>http://www.phpdeveloper.org/news/5133</link>
      <description><![CDATA[<i>Matthew Weir O'Phinney</i> has been working with PHPUnit and the SPL (Standard PHP Library) in PHP for a bit now, and he's discovered a way to integrate the two to automate the testing procedure.
<p>
<quote>
<i>
I've actually come to enjoy the PHPUnit2 style of tests. In the end, I find that my tests are much less verbose than the way I was performing them with phpt, and I tend to test for failure rather than success; failure should be the exception to the rule. The myriad of 'assert' methods make this relatively easy (though some operate in unexpected ways -- try testing assertSame() on two objects that contain PDO handles, for instance).
<p>
One thing that was missing for me was an easy way to run all tests in a directory, ala 'pear run-tests'. However, I was initially disappointed. The demonstrated way to do this is to manually require each test file and add the class contained therein to the test suite. Basically, I was going to need to touch the file every time I added a test class to the suite. Bleh!
</i>
</quote>
<p>
So, he <a href="http://weierophinney.net/matthew/archives/106-Automating-PHPUnit2-with-SPL.html">set about</a> working up his own solution - a regular expresion-based, recursive class that would locate the testing files and perform the specified actions. He shares the solution with a good bit of example code included with the post.]]></description>
      <pubDate>Mon, 10 Apr 2006 07:10:04 -0500</pubDate>
    </item>
  </channel>
</rss>
