<?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>Fri, 21 Nov 2008 08:30:31 -0600</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Havard Eide's Blog:  Countable]]></title>
      <guid>http://www.phpdeveloper.org/news/10739</guid>
      <link>http://www.phpdeveloper.org/news/10739</link>
      <description><![CDATA[<p>
In a <a href="http://eide.org/2008/07/30/countable/">new post</a> <i>Havard Eide</i> looks at the creation of a Countable interface that can be used in any application:
</p>
<blockquote>
Today I will look at the Countable interface, it has a single function that needs to be implemented: count(), by implementing this you can ensure that there is a count() function ready to use on any given class that implements it. The Countable interface is used in other places in the SPL as well: the ArrayIterator and ArrayObject classes implements this interface ( and SqliteResult if present ).
</blockquote>
<p>
In his code examples he shows simple methods for returning the count() of a property, but notes that the real power of it comes in the ability to manipulate the number returned from the call based on other parameters (or filtering).
</p>]]></description>
      <pubDate>Fri, 01 Aug 2008 10:23:28 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Rob Allen's Blog: Simple Zend_Form File Upload Example Revisited]]></title>
      <guid>http://www.phpdeveloper.org/news/10210</guid>
      <link>http://www.phpdeveloper.org/news/10210</link>
      <description><![CDATA[<p>
<i>Rob Allen</i> has <a href="http://akrabat.com/2008/05/16/simple-zend_form-file-upload-example-revisited/">revisited</a> a Zend_Form example he had created before, updating it with a fix for a common error people were seeing when the form tries to validate.
</p>
<blockquote>
I've been thinking about the <a href="http://akrabat.com/2008/04/07/simple-zend_form-file-upload-example/">Simple Zend_Form File Upload Example</a> that I discussed last month. To recap, if you haven't read the comments, if the form fails to validate for some reason then you get a nasty error.
</blockquote>
<p>
He corrects the issue by creating an ArrayObject (thanks to the SPL) that can be used both as an array and can look like a string to htmlspecialchars and changing up the validation a little bit to work with the new object.
</p>]]></description>
      <pubDate>Mon, 19 May 2008 09:33:13 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Matthew Weir O'Phinney's Blog: Overloading arrays in PHP 5.2.0]]></title>
      <guid>http://www.phpdeveloper.org/news/7129</guid>
      <link>http://www.phpdeveloper.org/news/7129</link>
      <description><![CDATA[<p>
In <a href="http://weierophinney.net/matthew/archives/131-Overloading-arrays-in-PHP-5.2.0.html">a new post</a> to his blog, <i>Matthew Weir O'Phinney</i> talks about a method for overloading arrays in a script written for the PHP 5.2 series.
</p>
<blockquote>
<p>
Several weeks back, a bug was reported against <a href="http://framework.zend.com/manual/en/zend.view.html">Zend_View</a> that had me initially stumped. [...] I'd read about this some months back on the php internals list, but at the time hadn't understood the consequences. 
</p>
<p>
Basically, __get() no longer returns a reference and returns values in read mode, which makes modifying arrays using overloading impossible using traditional methods.
</p>
</blockquote>
<p>
Unfortunately, this was exactly the functionality that was needed, so <i>Matthew</i> <a href="http://weierophinney.net/matthew/archives/131-Overloading-arrays-in-PHP-5.2.0.html">set out</a> to find a way to do just that. His initial method, extending the ArrayObject, worked but still gave errors. On <a href="http://mikenaberezny.com/">Mike Naberezny</a>'s recommendation, though, this too was resolved with a simple call to the __set method instead.
</p>]]></description>
      <pubDate>Sat, 19 Jan 2008 08:01:25 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Maarten Balliauw's Blog: Generic arrays in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/8902</guid>
      <link>http://www.phpdeveloper.org/news/8902</link>
      <description><![CDATA[<p>
On his blog, <i>Maarten Balliauw</i> has an <a href="http://blog.maartenballiauw.be/post/2007/10/Generic-arrays-in-PHP.aspx">interesting new post</a> dealing with the use of generics in PHP:
</p>
<blockquote>
Assuming everyone knows what generics are, let's get down to business right away. PHP does not support generics or something similar, though it could be very useful in PHP development.  Luckily, using some standard OO-practises, a semi-generic array can easily be created, even in multiple ways! Here's the road to PHP generics. 
</blockquote>
<p>
He <a href="http://blog.maartenballiauw.be/post/2007/10/Generic-arrays-in-PHP.aspx">shows</a> the two ways to make generics possible - the hard way (simple inheritance and type hinting) and the more flexible way (a GenericArrayObject that extends the normal ArrayObject to make appending and validating the contents of the array simple).
</p>]]></description>
      <pubDate>Thu, 25 Oct 2007 08:50:00 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Matthew Weir O'Phinney's Blog: Overloading arrays in PHP 5.2.0]]></title>
      <guid>http://www.phpdeveloper.org/news/6993</guid>
      <link>http://www.phpdeveloper.org/news/6993</link>
      <description><![CDATA[<p>
<i>Matthew Weir O'Phinney</i> has a new post on his blog today talking about <a href="http://weierophinney.net/matthew/archives/131-Overloading-arrays-in-PHP-5.2.0.html">overloading arrays</a> in PHP 5.2.0 using the magic __get and __construct functions.
</p>
<blockquote>
Several weeks back, a bug was reported against <a href="http://framework.zend.com/manual/en/zend.view.html">Zend_View</a>  that had me initially stumped. [...] Basically, __get() no longer returns a reference and returns values in read mode, which makes modifying arrays using overloading impossible using traditional methods.
</blockquote>
<p>
He <a href="http://weierophinney.net/matthew/archives/131-Overloading-arrays-in-PHP-5.2.0.html">gives a code example</a> of the problem and two ways to get around it - one using a switch statement to get around the problem and the other ("best solution") was <i>Matthew</i>'s option to extend the ArrayObject class.
</p>]]></description>
      <pubDate>Fri, 29 Dec 2006 07:33:00 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Mike Wallner's Blog: __get() and array rumors]]></title>
      <guid>http://www.phpdeveloper.org/news/6090</guid>
      <link>http://www.phpdeveloper.org/news/6090</link>
      <description><![CDATA[<p>
In <a href="http://blog.iworks.at/?/archives/47-__get-and-array-rumors.html">a brief new post</a>, <i>Mike Wallner</i> talks about some of the discussion surrounding overloaded array properties lately and something he's discovered about it.
</p>
<blockquote>
As arrays are the only complex types that are passed by value (resources don't really count here) the solution to described problem is simple: use an object; either an instance of stdClass or ArrayObject will do well, depending if you want to use array index notation.
</blockquote>
<p>
He <a href="http://blog.iworks.at/?/archives/47-__get-and-array-rumors.html">includes two code examples</a>, one just trying to overload it in a class with __get (yielding an error) and the other using the constructor to pass an ArrayObject out first, allowing for error-free assignment.
</p>]]></description>
      <pubDate>Mon, 21 Aug 2006 07:49:03 -0500</pubDate>
    </item>
  </channel>
</rss>
