<?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>Sun, 19 May 2013 01:12:59 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[PHPEasy.co.uk: Sorting array data using SplMaxHeap]]></title>
      <guid>http://www.phpdeveloper.org/news/18239</guid>
      <link>http://www.phpdeveloper.org/news/18239</link>
      <description><![CDATA[<p>
On PHPEasy.co.uk today there's a new tutorial posted showing you how to <a href="http://phpeasy.co.uk/sorting-array-data-using-splmaxheap/">sort using the SplMaxHeap</a> functionality provided by the <a href="http://php.net/spl">Standard PHP Library</a>.
</p>
<blockquote>
The SplMaxHeap class basically stores numbers in any order, and then returns them in descending order. In order to make this class useful for other data types other than numbers I have extend the SplMaxHeap class to compare dates and strings. SplMaxHeap extends SplHeap and implements the abstract class SplHeap::compare. Our extention of SplMaxHeap is therefore expected to implement the compare method.
</blockquote>
<p>
Code examples are given showing sorting by things like "last name" and "date of birth" (using <a href="http://php.net/strtotime">strtotime</a>). There's also an example of its use in sorting values from an array and outputted in a loop. You can find out more about this functionality in <a href="http://php.net/SplMaxHeap">the PHP manual</a>.
</p>]]></description>
      <pubDate>Wed, 18 Jul 2012 08:17:25 -0500</pubDate>
    </item>
  </channel>
</rss>
