<?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, 19 Jun 2013 19:04:20 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Anthony Ferrara's Blog: Parameter Type Casting in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/17632</guid>
      <link>http://www.phpdeveloper.org/news/17632</link>
      <description><![CDATA[<p>
<i>Anthony Ferrara</i> has a new article posted to his site today about <a href="http://blog.ircmaxell.com/2012/03/parameter-type-casting-in-php.html">parameter typecasting</a> and the discussions that have been happening about it on the PHP "<a href="http://php.net/mailing-lists.php">internals</a>" mailing list.
</p>
<blockquote>
As any of you who follow the <a href="http://news.php.net/php.internals">PHP internals</a> list know, scalar type hinting has been a hot topic as of late.  You'll also know that I've submitted two new RFC (Request For Comment) proposals for inclusion of two new major features in the PHP language.  I figured it was worth going into both RFCs and patches a little deeper, explain my rationale and (hopefully) garner some more visibility of the proposals.
</blockquote>
<p>
He shares the details of the two main RFCs that are proposed right now - parameter type casting hints and object scalar casting magic methods (both with code examples). Right now, they're only in the patch stage and there's talk of improving the current casting functionality of PHP before something like one of these goes into place. 
</p>]]></description>
      <pubDate>Tue, 06 Mar 2012 11:05:32 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[David Otton's Blog: Neat PHP tricks: Casting Arrays to Objects]]></title>
      <guid>http://www.phpdeveloper.org/news/10834</guid>
      <link>http://www.phpdeveloper.org/news/10834</link>
      <description><![CDATA[<p>
<i>David Otton</i> has a <a href="http://www.otton.org/2008/08/14/neat-php-tricks-casting-arrays-to-objects/">handy little tip</a> if you're looking for a cleaner way to deal with array data - casting it to an object.
</p>
<blockquote>
Array notation is fine, but it can look a bit clunky when you're working with complex structures. [...] Casting the array to an object allows us to use object notation (->) and makes the code more readable.
</blockquote>
<p>
He includes examples of the casting, showing the difference between the array and object notations including a method for creating an object based on a simple array that has basic properties built in. This sort of transformation can be useful if you want consistency through out the application - just passing objects with their properties rather than arrays.
</p>]]></description>
      <pubDate>Thu, 14 Aug 2008 13:38:10 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Arnold Daniels' Blog: A dark corner of PHP: class casting]]></title>
      <guid>http://www.phpdeveloper.org/news/9670</guid>
      <link>http://www.phpdeveloper.org/news/9670</link>
      <description><![CDATA[<p>
In <a href="http://blog.adaniels.nl/articles/a-dark-corner-of-php-class-casting/">this blog entry</a> <i>Arnold Daniels</i> talks about an issue he had in the past (needing a bit more functionality than the <a href="http://pear.php.net/package/DB">PEAR DB library</a> could offer) and how he ended up solving it with what he calls a "dark corner" of PHP - class casting.
</p>
<blockquote>
PHP has a function serialize, which can create a hash from any type of variable, scalars, array, but objects as well. Using the unserialize function, PHP can recreate the variable from the serialized hashed. If we look at how an object is serialized, we see only the properties and the class name are stored.
</blockquote>
<p>
<a href="http://blog.adaniels.nl/articles/a-dark-corner-of-php-class-casting/">His method</a> allows for class manipulation via changes to the serialized class information (like changing the value of the name parameter). His "casttoclass()" function makes changing this value simple.
</p>]]></description>
      <pubDate>Wed, 20 Feb 2008 12:08:00 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Christopher Jones' Blog: Casting PL/SQL arrays as REF CURSORS for Ruby (and PHP)]]></title>
      <guid>http://www.phpdeveloper.org/news/6808</guid>
      <link>http://www.phpdeveloper.org/news/6808</link>
      <description><![CDATA[<p>
In a <a href="http://blogs.oracle.com/opal/2006/11/30#a87">new post</a>, <i>Christopher Jones</i> talks about some difficulty a friend of his was having with returning a connection type from Oracle back to a script. In his case, it was a Ruby script and, unfortunately, there's no direct support for it. So, <i>Christopher</i> jumped in to help out.
</p>
<blockquote>
<p>
PHP's oci8 extension oci_bind_array_by_name() can bind collections but there is no equivalent in ruby-oci8. 
</p>
<p>
Justin outlines a solution on his blog <a href="http://jasonvogel.blogspot.com/2006/11/invoking-plsql-package-routine-with.html">Ruby: Invoking a PL/SQL Package with Array args</a>. His example relies on some company infrastructure so I came up with this standalone example.  This first SQL*Plus script sets up the scenario.
</p> 
</blockquote>
<p>
Stick with me on this one - there's some PHP right there <a href="http://blogs.oracle.com/opal/2006/11/30#a87">at the end</a>. He shows how much simpler the same kind of operation would be in PHP thanks to the oci_bind_array_by_name functionality understanding the return value. What took about 20 lines for just the Ruby code to handle the result correctly takes only five in PHP.
</p>]]></description>
      <pubDate>Fri, 01 Dec 2006 10:41:00 -0600</pubDate>
    </item>
  </channel>
</rss>
