<?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>Wed, 22 May 2013 11:19:09 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Ben Ramsey: Introducing Array_column() in PHP 5.5]]></title>
      <guid>http://www.phpdeveloper.org/news/19344</guid>
      <link>http://www.phpdeveloper.org/news/19344</link>
      <description><![CDATA[<p>
<i>Ben Ramsey</i> has a new post talking about a feature that will become available in the PHP 5.5.x release series of the language - the <a href="http://benramsey.com/blog/2013/03/introducing-array-column-in-php-5-dot-5/">array_column</a> function. This function will extract all values from an array matching a given key.
</p>
<blockquote>
My original patch for array_column() was written for PHP 5.2, but it sat around collecting dust for many years, until April of last year, when PHP moved to git and GitHub. That's when it became easy enough to apply the patch and send a pull request, which I did. [...] My goal for array_column() was simplicity. Many implement the functionality in different ways, and many call the function by other names (such as "pluck"), but I wanted to keep it simple and recognizable.
</blockquote>
<p>
He includes an example of some sample data and how the function could be used to pull out the "last_name" field from each of the records and return just those as an array. If you're interested in seeing the original proposal and the RFC that was created for it, you can see it <a href="https://wiki.php.net/rfc/array_column">on the PHP wiki</a>.
</p>]]></description>
      <pubDate>Thu, 21 Mar 2013 10:46:01 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Setfive.com: PHP: Some thoughts on using array_* with closures]]></title>
      <guid>http://www.phpdeveloper.org/news/19331</guid>
      <link>http://www.phpdeveloper.org/news/19331</link>
      <description><![CDATA[<p>
On the Setfive site there's a recent post from <i>Ashish Datta</i> about <a href="http://shout.setfive.com/2013/03/18/php-some-thoughts-on-using-array_-with-closures/">some thoughts around array functions and closures</a> for callback methods.
</p>
<blockquote>
The other day, I was hacking away on the PHP backend for the "Startup Institute" visualization and I realized it was going to need a good deal of array manipulation. Figuring it was as good a time as any, I decided to try and leverage PHP 5.3+ new closures along with the array_* functions to manipulate the arrays. I'm not well versed with functional programming but I've used Underscore.js's array/collection functions so this is mostly in comparison to that.
</blockquote>
<p>
He gives a sample data set he's pulling from - basic user data - and goes through a few different actions that can be taken on the data (with code examples for each): sorting, mapping and filtering. He shows the use of closures as the callback methods instead of defining them separately and passing in their names. 
</p>]]></description>
      <pubDate>Tue, 19 Mar 2013 10:36:22 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Sherif Ramadan: A Closer Look Into PHP Arrays: What You Don't See]]></title>
      <guid>http://www.phpdeveloper.org/news/18670</guid>
      <link>http://www.phpdeveloper.org/news/18670</link>
      <description><![CDATA[<p>
In a new post <i>Sherif Ramadan</i> takes an <a href="http://sheriframadan.com/2012/10/a-closer-look-into-php-arrays/">in-depth look at PHP arrays</a> and what happens behind the scenes when they're put to use. 
</p>
<blockquote>
PHP is one unique language where the array data type has been highly generalized to suit a very broad set of use cases. [...] I'm going to share with you some of the underlying details of how the PHP array data type works, why it works the way that it does, how it's different from other languages, and what behaviors the PHP array has that you may not be fully aware of.
</blockquote>
<p>
He starts with a section looking at what arrays actually are in PHP (and how they compare to the lower level C arrays). He gives a C-based array example and shows how it's <a href="http://sheriframadan.com/wp-content/uploads/2012/10/c-array.png">stored in memory</a>. He points out how PHP arrays are different from other languages and shows the C code that works behind the scenes to create the array (actually a hashtable). He gets into a detailed explanation of the iteration of arrays including some basic benchmarks of some of the various methods and gets more in-depth with <a href="http://php.net/foreach">foreach</a> (including subarrays and arrays containing references).
</p>]]></description>
      <pubDate>Mon, 29 Oct 2012 11:43:33 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[MaltBlue.com: Painless Data Traversal with PHP FilterIterators]]></title>
      <guid>http://www.phpdeveloper.org/news/18654</guid>
      <link>http://www.phpdeveloper.org/news/18654</link>
      <description><![CDATA[<p>
On the MaltBlue blog <i>Matt Setter</i> has a new post introducing you to <a href="http://www.maltblue.com/php/painless-data-traversal-with-php-filteriterators">using FilterIterators for data traversal</a>:
</p>
<blockquote>
There's load of ways to traverse data, especially in PHP where there are a variety of loops available; including while, do while, for and foreach. These are fine for normal structures, such as scalar and associative arrays. But what if you want to get a bit more fancy?
</blockquote>
<p>
He includes a bit of code showing the typical looping approach that a lot of developers take and how, using a <a href="http://php.net/filteriterator">FilterIterator</a>, you can extend the default and make a custom "accept" method to remove certain matching items from the data set.
</p>]]></description>
      <pubDate>Thu, 25 Oct 2012 08:54:35 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: Spooky Scary PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/18650</guid>
      <link>http://www.phpdeveloper.org/news/18650</link>
      <description><![CDATA[<p>
In the spirit of Halloween coming next week PHPMaster.com has posted some <a href="http://phpmaster.com/spooky-scary-php/">spooky scary PHP</a> code in their latest post from the editor of the site, <i>Timothy Boronczyk</i>.
</p>
<blockquote>
Break out the candy corn and apple cider; it's that time of year again! The rest of the world may not celebrate Halloween as hog wild as in America, but I thought it'd be fun to share some scary PHP stuff to mark the holiday. This is a fun article, sharing with you some scary (but logical) behavior found in PHP itself, and spooky (and possibly quite illogical) ways in which some have twisted PHP to do their bidding. Think of this as my treat to you, a little bit of geek "mind-candy" - because why should all the trick-or-treaters have all goodies?
</blockquote>
<p>
The code examples include "The Haunted Array", "The Phantom Database Connection" and "An API Worthy of Dr. Frankenstein". Enjoy! (and maybe share some of your own too)
</p>]]></description>
      <pubDate>Wed, 24 Oct 2012 08:39:22 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Thomas Weinart: What Iterators Can Do For You]]></title>
      <guid>http://www.phpdeveloper.org/news/18301</guid>
      <link>http://www.phpdeveloper.org/news/18301</link>
      <description><![CDATA[<p>
<i>Thomas Weinert</i> has a new post to his site showing some of the things that <a href="http://www.a-basketful-of-papayas.net/2012/07/what-iterators-can-do-for-you.html">iterators can do for you</a> (including working with arrays and aggregation).
</p>
<blockquote>
Basically Iterators provide a list interface for an object. Like all interfaces they are a contract how something can be used. If you use an interface it is not relevant how it is implemented - the implementation logic is encapsulated. It is of course relevant on the integration level. A bad implementation can impact the performance of you application. Even an good implementation may need special resources (like a database). But all this does not impact how you use it. Your code using the object with the Iterator interface stays the same.
</blockquote>
<p>
He shows how to use the <a href="http://php.net/IteratorAggregate"> IteratorAggregate</a>, <a href="http://php.net/ArrayIterator"> ArrayIterator</a>,  <a href="http://php.net/FilterIterator"> FilterIterator</a> and how to create a custom Iterator that you can extend in your own code.
</p>]]></description>
      <pubDate>Wed, 01 Aug 2012 09:55:22 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: Using SPL Iterators, Part 2]]></title>
      <guid>http://www.phpdeveloper.org/news/17986</guid>
      <link>http://www.phpdeveloper.org/news/17986</link>
      <description><![CDATA[<p>
On PHPMaster.com today they've posted the <a href="http://phpmaster.com/using-spl-iterators-2/">second part of the series</a> covering the Iterators that come with PHP as a part of the <a href="http://php.net/spl">SPL</a>.
</p>
<blockquote>
In <a href="http://phpmaster.com/using-spl-iterators-1">part one</a> of this series I introduced you to some of the SPL Iterators and how to use them. There may be times however when the provided iterators are insufficient for your needs and you'll want to roll your own custom iterator. Luckily, SPL provides interfaces that will allow you to do just that. For an object to be traversable in a foreach loop, PHP requires that it be an instance of Traversable. You cannot however implement this interface directly (though you can use it in instaceof checks); instead you'll need to implement either SPL's Iterator or IteratorAggregate interfaces.
</blockquote>
<p>
He shows you how to implement these two interfaces in your own custom classes, looping through a set of books for the Iterator example and a "getIterator" method that creates an <a href="http://php.net/arrayiterator">ArrayIterator</a> when executed. The results of both are used in foreach loops showing how they can be used just like any other iteratable variables.
</p>]]></description>
      <pubDate>Tue, 22 May 2012 08:23:17 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: Using SPL Iterators, Part 1]]></title>
      <guid>http://www.phpdeveloper.org/news/17962</guid>
      <link>http://www.phpdeveloper.org/news/17962</link>
      <description><![CDATA[<p>
On PHPMaster.com today there's a new tutorial posted, the first part of a series, looking at the use of the <a href="http://php.net/spl">Standard PHP Library (SPL)</a> in PHP. In <a href="http://phpmaster.com/using-spl-iterators-1/">this first part</a> of the series, <i>Stefan Froelich</i> looks specifically at two of the more common uses for iterators - working with arrays and directories.
</p>
<blockquote>
When I first came across the term iteration and saw the overwhelming list of classes related to it in the SPL, I was taken aback. It seemed maybe iteration was too complex for me to grasp. I soon realized it was just a fancy word for something we programmers do all the time. [...] In the first part of this two-part series I'll introduce you to iteration and how you can take advantage of some of the built-in classes from the Standard PHP Library (SPL).
</blockquote>
<p>
Included in the tutorial is example code showing how to use the <a href="http://php.net/arrayiterator">ArrayIterator</a> to work with an array and the <a href="http://php.net/directoryiterator">DirectoryIterator</a> to process the contents of a directory. He also briefly touches on a few other iterators like "FileExtensionFilter", "RecursiveDirectoryIterator" and "RecursiveArrayIterator".
</p>]]></description>
      <pubDate>Tue, 15 May 2012 12:26:59 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Nikita Popov's Blog: Understanding PHP's internal array implementation (Part 4)]]></title>
      <guid>http://www.phpdeveloper.org/news/17749</guid>
      <link>http://www.phpdeveloper.org/news/17749</link>
      <description><![CDATA[<p>
<i>Nikita Popov</i> has posted the <a href="http://nikic.github.com/2012/03/28/Understanding-PHPs-internal-array-implementation">fourth part</a> of the "PHP's Source Code for PHP Developers" series he and <i>Anthony Ferrara</i> have been posting. In this latest article in the series, <i>Nikita</i> looks specifically at PHP's array implementation and how it's handed "behind the scenes".
</p>
<blockquote>
Welcome back to the fourth part of the "PHP's Source Code for PHP Developers" series, in which we'll cover how PHP arrays are internally represented and used throughout the code base.
</blockquote>
<p>
He starts with an obvious foundation: "everything's a hash table" (even properties, classes and yes, arrays). He describes what a hash table is and talks about two of the most commonly used versions of it in the PHP source - HashTable and Bucket. He gets into their usage a bit and compares this to the corresponding PHP code that uses a standard array.
</p>]]></description>
      <pubDate>Thu, 29 Mar 2012 09:16:02 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Konr Ness' Blog: Zend_Config Benchmark - JSON, Array, INI, XML, YAML]]></title>
      <guid>http://www.phpdeveloper.org/news/17647</guid>
      <link>http://www.phpdeveloper.org/news/17647</link>
      <description><![CDATA[<p>
In <a href="http://konrness.com/php5/zend_config-benchmark-json-array-ini-xml-yaml/">this recent post</a> to his blog, <i>Konr Ness</i> has benchmarked the components that the Zend Framework uses to read in different types of configuration files - JSON, native PHP arrays, INI, XML and YAML files.
</p>
<blockquote>
If you application relies on parsing one or several config files each time it is bootstrapped it is important that you select a file format that is fast to parse. But you also want to select a config file format that is easy for a human to read and edit. In a recent application I am building I also had the need to write modifications to config files, so I also benchmarked the Zend_Config_Writer components.
</blockquote>
<p>
He includes both the sample configuration INI file and the benchmarking script he used to measure the results (all configurations were read from external files, even the native PHP option). His results were pretty predictable (with the exception of YAML reading) with the standard INI file coming in second to the native PHP arrays, but having the advantage of being more readable.
</p>]]></description>
      <pubDate>Thu, 08 Mar 2012 11:51:32 -0600</pubDate>
    </item>
  </channel>
</rss>
