<?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>Tue, 21 May 2013 13:14:37 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[WebTutor.pl: Strong data typing in PHP, part II: autoboxing and indestructable objects]]></title>
      <guid>http://www.phpdeveloper.org/news/16198</guid>
      <link>http://www.phpdeveloper.org/news/16198</link>
      <description><![CDATA[<p>
In the second part of their series looking at data typing in PHP, the WebTutor blog takes a different approach to supporting strong typing in PHP, using <a href="http://php.webtutor.pl/index.php/2011/04/13/strong-data-typing-in-php-part-ii-autoboxing-and-indestructable-objects-english-version/">autoboxing and indestructible objects</a>.
</p>
<blockquote>
In an earlier <a href="http://php.webtutor.pl/index.php/2011/03/23/silne-typowanie-danych-w-php-czesc-i/">article on the strong typing</a> I've described the typehint mechanism that provides data type enforcement for the values sent to the methods and functions. Unfortunately said implementation does not protect against another problem associated with the dynamic typing of variables: a lack of type enforcement when overwritting value of an existing variable. In order to control the type of data, I decided to introduce to PHP the concept of autoboxing known from other languages such as C# and Java.
</blockquote>
<p>
He talks briefly about what autoboxing is (wrapping primitive types into objects automatically) and links to <a href="http://webscripts.softpedia.com/script/PHP-Clases/Java-and-C--compatible-object-autoboxing-66176.html">a library</a> that can be used to accomplish it. A bit of sample code is included showing how to create an AutoBoxedObject and how to use it in practice on some string values.
</p>]]></description>
      <pubDate>Thu, 14 Apr 2011 12:09:40 -0500</pubDate>
    </item>
  </channel>
</rss>
