<?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>Thu, 20 Nov 2008 08:50:09 -0600</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[PHP 10.0 Blog: duck operator]]></title>
      <guid>http://www.phpdeveloper.org/news/10352</guid>
      <link>http://www.phpdeveloper.org/news/10352</link>
      <description><![CDATA[<p>
In <a href="http://php100.wordpress.com/2008/06/05/duck-operator/">this new post</a> to the PHP 10.0 blog today, <i>Stas</i> talks about <a href="http://en.wikipedia.org/wiki/Duck_typing">duck typing</a>, a method that lets the code decide the functionality to use rather than a direct relation to a parent.
</p>
<blockquote>
Well, if you are into <a href="http://en.wikipedia.org/wiki/Duck_typing">duck typing</a> style of programming, it may be interesting for you to have an object that implements certain set of functions, but not necessary declares it at class definition. Languages like Smalltalk do it all day along, so why PHP couldn't?
</blockquote>
<p>
His example defines an interface Cow and a class MooingGrassEater and a function, CowConsumer, that does the work. A classname is passed in and an instance of that class is checked with "implements" rather than "instanceof" to see if it uses the Cow interface. He points out a place where PHP itself uses something similar in <a href="http://php.net/manual/en/function.stream-wrapper-register.php">user defined streams</a>.
</p>]]></description>
      <pubDate>Thu, 05 Jun 2008 14:36:31 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Michael Girouard's Blog: One Step Closer to an Abstract Singleton]]></title>
      <guid>http://www.phpdeveloper.org/news/9122</guid>
      <link>http://www.phpdeveloper.org/news/9122</link>
      <description><![CDATA[<p>
<i>Michael Girouard</i> has <a href="http://www.lovemikeg.com/blog/2007/11/24/one-step-closer-to-an-abstract-singleton/">pointed out</a> that things in the PHP world are one step closer to being able to create an abstract Singleton object via a simple script he's shared.
</p>
<blockquote>
<p>
The singleton is an incredibly useful pattern in PHP for many reasons. I tend to find myself using them when I know I should be using static classes, but can't because of PHP's lack of proper class name discovery in extended static classes. 
</p>
<p>
[...] And that works like a charm every time. The problem is, in one application there may be several classes that need to be singletons. In which case my first thought was to build an abstract singleton.
</p>
</blockquote>
<p>
Unfortunately, it didn't quite work like he'd thought it would. He did, however, come up with something that did work - creating an interface and making an abstract implementation of it (code example for this included). 
</p>]]></description>
      <pubDate>Tue, 27 Nov 2007 09:37:00 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[CodeSnipers.com: Embarking on PHP5 Objects]]></title>
      <guid>http://www.phpdeveloper.org/news/4680</guid>
      <link>http://www.phpdeveloper.org/news/4680</link>
      <description><![CDATA[From CodeSnipers.com today, there's a new post with their look at <a href="http://codesnipers.com/?q=node/218&title=">objects in PHP5</a> - how they work, how they're different from in PHP4, and some code to show their use.
<p>
<quote>
<i>
After a brief few weeks studying Perl and its nuances I'm going to take a look at PHP5 Objects. 
<p>
One of the annoying things with object in PHP 4 was you had to use a lot of references, you know, that funny & symbol. No longer needed in PHP 5 because you use "Object Handles" perhaps similar to a file handler you when fopen a file. Also available now are access modifiers "public/protected/package" and interface implementation. I can hear the beer mugs of java programmers being raised in celebration to this one. Also new to PHP 5 are real constructors and destroy methods. There are many more features, but lets see some code.
</i>
</quote>
<p>
There are <a href="http://codesnipers.com/?q=node/218&title=">code examples</a> that show some of the new keywords (private, public, etc) that the object structure uses, as well as how you can use them. They link to the PDF of <a href="http://www.phptr.com/content/images/013147149X/downloads/013147149X_book.pdf">Power PHP 5 Programming</a> for a good place to start...]]></description>
      <pubDate>Wed, 18 Jan 2006 06:40:42 -0600</pubDate>
    </item>
  </channel>
</rss>
