<?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>Mon, 06 Oct 2008 11:20:50 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[TotalPHP:  Using an autoload function to make your life easier]]></title>
      <guid>http://www.phpdeveloper.org/news/11131</guid>
      <link>http://www.phpdeveloper.org/news/11131</link>
      <description><![CDATA[<p>
On the TotalPHP blog there's <a href="http://www.total-php.com/article/14/using-an-autoload-function-to-make-your-life-easier/">a recent post</a> introducing you to a feature in PHP5 that can make life much easier - autoload.
</p>
<blockquote>
In PHP 5 you can make your life a lot easier by writing an autoload function. This function will automatically load your classes, so you do not need to repeatedly include classes on every page.
</blockquote>
<p>
Included are <a href="http://www.total-php.com/article/14/using-an-autoload-function-to-make-your-life-easier/">examples</a> of it in action - both a simple definition and as it might be used in an application to conditionally load a class from multiple locations.
</p>]]></description>
      <pubDate>Thu, 02 Oct 2008 08:46:59 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Elizabeth Smith's Blog: My five (well four and one-half) issues with namespaces]]></title>
      <guid>http://www.phpdeveloper.org/news/10986</guid>
      <link>http://www.phpdeveloper.org/news/10986</link>
      <description><![CDATA[<p>
Even with the release of PHP 5.3 looming closer and closer on the horizon, there's a few things that are still being worked through - one of which is the much touted namespace support. <i>Elizabeth Smith</i> has <a href="http://elizabethmariesmith.com/2008/09/my-five-well-four-and-one-half-issues-with-namespaces/">posted a few</a> of the issues that she's having with how they're being implemented, four and a half of them, to be exact.
</p>
<blockquote>
The first thing to clarify is that I like the new implementation overall, it's fairly light and although it isn't really namespacing or packaging in any sense of the word, the best way to describe it is aliasing, it does help keep code easy to use. In fact I have a couple of projects and even a PHP extension that's all namespaced code.
</blockquote>
<p>Her list of five (four and a half) things are:</p>
<ul>
<li>multiple namespaces in a file
<li>you can't have ANYTHING before the namespace statement but an opening &lt;?php tag
<li>The autoload and resolution paths
<li>Functions in namespaces
<li>No use * and three million use statements (this is the one with the workaround - class_alias)
</ul>]]></description>
      <pubDate>Tue, 09 Sep 2008 08:46:35 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Jaisen Methai's Blog: Stop including class files and use __autoload() instead]]></title>
      <guid>http://www.phpdeveloper.org/news/10530</guid>
      <link>http://www.phpdeveloper.org/news/10530</link>
      <description><![CDATA[<p>
On his blog, <i>Jaisen Methai</i> <a href="http://www.jaisenmathai.com/blog/2008/06/25/stop-including-class-files-and-use-__autoload-instead/">posted about</a> a very handy feature of PHP5 - the __autoload function.
</p>
<blockquote>
It's one of the gems in PHP that I find to be relatively under used.  It's common for PHP applications to break out classes into their own files.  This becomes cumbersome when working on large projects as you wind up with numerous include/require calls for any given page. 
</blockquote>
<p>
He shows an example of its usage (loading class files dynamically from a specified directory) and mentions how it can help to make your code a lot less ugly. Comments on <a href="http://www.jaisenmathai.com/blog/2008/06/25/stop-including-class-files-and-use-__autoload-instead/">the post</a> range in topics - from comparing it to include paths, how the idea was borrowed from PEAR, and how proper naming conventions can make its use even easier.
</p>]]></description>
      <pubDate>Wed, 02 Jul 2008 11:11:50 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Padraic Brady's Blog: HTMLPurifer 3.1.0 Release Candidate Available]]></title>
      <guid>http://www.phpdeveloper.org/news/10021</guid>
      <link>http://www.phpdeveloper.org/news/10021</link>
      <description><![CDATA[<p>
<i>Padraic Brady</i> has <a href="http://blog.astrumfutura.com/archives/352-HTMLPurifer-3.1.0-Release-Candidate-Available.html">noted</a> that the latest release candidate of the HTMLPurifier software has been posted for download:
</p>
<blockquote>
HTMLPurifer is possibly the most understated underpublicised quality library in PHP today. I consider it a fundamental standard library that is automatically included in every PHP web application I start these days.
</blockquote>
<p>
This latest <a href="http://htmlpurifier.org/news/2008/3.1.0rc1-released.html">release candidate</a> (their first!) includes updates on two major features - the use of autoloading and a change to the way you use the filters. Check out <a href="http://htmlpurifier.org/demo.php">a demo</a> of it in action or just <a href="http://htmlpurifier.org/download.html">download</a> this latest release and try it out for yourself.
</p>]]></description>
      <pubDate>Wed, 23 Apr 2008 09:31:40 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Jan Lehnardt's Blog: Using the Zend Framework with Code Igniter (an alternative)]]></title>
      <guid>http://www.phpdeveloper.org/news/9317</guid>
      <link>http://www.phpdeveloper.org/news/9317</link>
      <description><![CDATA[<p>
On his blog <i>Jan Lehnardt</i> has posted <a href="http://jan.prima.de/~jan/plok/archives/114-Using-the-Zend-Framework-with-Code-Igniter-an-alternative.html">an alternative method</a> for using the Code Igniter framework together with the Zend Framework with only the parts you need.
</p>
<blockquote>
I want to use <a href="http://jan.prima.de/~jan/plok/exit.php?url_id=1410&entry_id=114">Code Igniter</a> for some applications and I want to use some bits of the <a href="http://jan.prima.de/~jan/plok/exit.php?url_id=1411&entry_id=114">Zend Framework</a> inside my Code Igniter classes. There is <a href="http://jan.prima.de/~jan/plok/exit.php?url_id=1412&entry_id=114">a tutorial</a> explaining how to set it up. But there is a problem.
</blockquote>
<p>
He reverses the method the other tutorial uses and chooses to go with Code Igniter for the application logic side of things, making use of the helper and autoload functionality of CodeIgniter to pull things together. He includes code to make his method clear.
</p>]]></description>
      <pubDate>Thu, 27 Dec 2007 08:46:00 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[DevShed: Displaying Meaningful Error Messages when Auto Loading Classes in PHP 5]]></title>
      <guid>http://www.phpdeveloper.org/news/9314</guid>
      <link>http://www.phpdeveloper.org/news/9314</link>
      <description><![CDATA[<p>
DevShed has <a href="http://www.devshed.com/c/a/PHP/Displaying-Meaningful-Error-Messages-when-Auto-Loading-Classes-in-PHP-5/">posted the next part</a> of their series looking at handling errors thrown by the __autoload functionality of PHP. This time they enhance their previous method and allow for custom error messaging.
</p>
<blockquote>
In this last article of the series I'm going to introduce some additional modifications to the current signature of the "__autoload()" function to make it throw exceptions that display more useful error messages.
</blockquote>
<p>
They start by <a href="http://www.devshed.com/c/a/PHP/Displaying-Meaningful-Error-Messages-when-Auto-Loading-Classes-in-PHP-5/1/">setting up the application</a> to have something to build from (a series of PHP scripts). They add on the exception handling to throw the custom error (the "class not found" they mentioned).
</p>]]></description>
      <pubDate>Wed, 26 Dec 2007 11:56:00 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[DevShed: Improving Exception Throwing when Auto Loading Classes in PHP 5]]></title>
      <guid>http://www.phpdeveloper.org/news/9268</guid>
      <link>http://www.phpdeveloper.org/news/9268</link>
      <description><![CDATA[<p>
DevShed continues their looks at autoloading classes in PHP5 today with <a href="http://www.devshed.com/c/a/PHP/Improving-Exception-Throwing-when-Auto-Loading-Classes-in-PHP-5/">this new tutorial</a> focusing on catching and handling any errors that might be thrown in the process.
</p>
<blockquote>
This is the third article in the series on how to auto load classes in PHP 5. This article will demonstrate how to trigger exceptions in a way that can be caught by the corresponding "catch()" block.  [...] Nonetheless, this issue can be fixed with relative ease. That will be the goal of this third article of the series. So if you're interested in learning how this solution will be implemented, don't waste any more time and start reading now!
</blockquote>
<p>
They start by <a href="http://www.devshed.com/c/a/PHP/Improving-Exception-Throwing-when-Auto-Loading-Classes-in-PHP-5/1/">looking at</a> throwing an exception with the __autoload so that the script can catch it. The go back to mention the method they'd talked about before - using just eval() - and then show the "new and improved" method of handling the result with a try/catch block instead of a direct output.
</p>]]></description>
      <pubDate>Tue, 18 Dec 2007 12:56:00 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[DevShed: Throwing Basic Exceptions When Auto Loading Classes in PHP 5 ]]></title>
      <guid>http://www.phpdeveloper.org/news/9225</guid>
      <link>http://www.phpdeveloper.org/news/9225</link>
      <description><![CDATA[<p>
DevShed has <a href="http://www.devshed.com/c/a/PHP/Throwing-Basic-Exceptions-When-Auto-Loading-Classes-in-PHP-5/">posted the second part</a> of their series looking at handling exceptions in a PHP5 application today. This one focuses on capturing the errors thrown when your script autoloads classes.
</p>
<blockquote>
Bearing in mind this intrinsic limitation exposed by the "__autoload()" magic function when it comes to triggering exceptions at runtime, in this second article  of the series I'm going to show you some basic workarounds that you can implement to provide this function with the ability to throw exceptions when a determined source class fails to be included.
</blockquote>
<p>
They give <a href="http://www.devshed.com/c/a/PHP/Throwing-Basic-Exceptions-When-Auto-Loading-Classes-in-PHP-5/1/">two examples</a> of the use of the __autoload function as well as a method to capture the fatal errors that it might throw (using an eval inside of it to check on the class).
</p>]]></description>
      <pubDate>Wed, 12 Dec 2007 07:55:00 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[I/O Reader: 15 Cool Things & 12 Things to Dislike About PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/8484</guid>
      <link>http://www.phpdeveloper.org/news/8484</link>
      <description><![CDATA[<p>
On the <a href="http://ioreader.com/">I/O Reader blog</a>, there's two different posts that take two sides of the spectrum when it comes to what to like and dislike about PHP, both lists of features of the the language:
</p>
<ul>
<li><a href="http://ioreader.com/2007/08/17/11-cool-things-about-php-that-most-people-overlook/">15 Cool Things About PHP That Most People Overlook</a> - a list including the Reflection API, the Standard PHP Library, type hinting and the "magic" functions.
<li><a href="http://ioreader.com/2007/08/19/12-things-you-should-dislike-about-php/">12 Things You Should Dislike About PHP</a> - this list includes things like naming conventions, that _tostring doesn't work as (he) expected, magic quotes and register globals and safe mode
</ul>
<p>
Both have their valid points and it's interesting to see how many of the points made in the first article he goes back on and mentions specific instances where it doesn't work as expected. Some of the comparisons seem a bit like he's comparing PHP to his experience in another language and not objectively on PHP's features alone.
</p>]]></description>
      <pubDate>Mon, 20 Aug 2007 08:32:00 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Joakim Nygard's Blog: Optimizing PHP Through Habits]]></title>
      <guid>http://www.phpdeveloper.org/news/7705</guid>
      <link>http://www.phpdeveloper.org/news/7705</link>
      <description><![CDATA[<p>
Spurred on by <a href="http://www.ilia.ws/files/zend_performance.pdf">some previous benchmarks</a> [pdf] from <i>Ilia Alshanetsky</i>, <i>Joakim Nygard</i> decided to <a href="http://jokke.dk/2007/03/optimizing_php_through_habits">run some his own benchmarks</a> on the same sort of functionality.
</p>
<blockquote>
There are numerous discussions in the blogosphere about whether to use <a href="http://www.google.com/search?q=php+echo+vs+print">echo versus print</a>, if <a href="http://www.google.com/search?q=php+for+benchmark+while">for() is faster than while()</a>, etc. and though the gains are usually very small, I decided to add my thoughts to the debate. I found an article on optimization through coding habits in <a href="http://www.ilia.ws/files/zend_performance.pdf">Ilia Alshanetsky's zend performance slides</a>.
</blockquote>
<p>
According to <a href="http://jokke.dk/2007/03/optimizing_php_through_habits">his results</a>:
<ul>
<li>Calling require_once() 10000 times in a for() loop with an empty file is 4x faster.
<li>With a simply autoload requiring a class and 10000 loops of new Foo() versus require_once('foo.php'); new Foo() shows that __autoload() is ~3.7 times faster.
<li>If a class method can be static, declare it static. Speed improvement is by a factor of 4.
<li>Avoid function calls within for() loop control blocks
<li>Always, always quote array keys.
<li>Get rid of 'harmless' error messages - they take time to generate and output. 
</ul>
</p>
<blockquote>
I am not out to prove Ilia wrong - he knows PHP better than most - and for all I know, they could have optimized those very functions in PHP 5.2. [...] It would appear that there are improvements, albeit small, to achieve from minimal effort. Plus I was surprised by the discrepancies I found compared to Ilia's recommendations.
</blockquote>]]></description>
      <pubDate>Wed, 25 Apr 2007 10:39:00 -0500</pubDate>
    </item>
  </channel>
</rss>
