<?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, 24 May 2013 01:05:17 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Anthony Ferrara: Is Autoloading A Good Solution?]]></title>
      <guid>http://www.phpdeveloper.org/news/18255</guid>
      <link>http://www.phpdeveloper.org/news/18255</link>
      <description><![CDATA[<p>
In his <a href="http://blog.ircmaxell.com/2012/07/is-autoloading-good-solution.html">most recent post</a> <i>Anthony Ferrara</i> takes a look at autoloading - mostly asking the question of whether the problems it has really outweigh the benefits.
</p>
<blockquote>
The real problem that autoloaders solve is to load dependencies. [...] The normal logic that's used to justify autoloading over manual dependency loading in production is that it only loads the classes you need. Therefore you save the parsing costs of classes that you don't need. But surely that additional run-time loading has costs. So I decided to setup a test to see how expensive that additional run-time loading costs us, and to prove whether or not autoloading is worth it in production.
</blockquote>
<p>
He gives an example of the two methods - using the <a href="http://php.net/spl_autoload_register"> spl_autoload_register</a> method to define a loader and loading them with a defined file path instead. He found the autoloading version slower than the hard-coded (by quite a bit) but how, when the number of files is reduced, the performance gets much closer. He also briefly looks at two other pieces of file-related functionality: <a href="http://php.net/file_exists">file_exists</a> and <a href="http://php.net/require_once">require_once</a>.
</p>]]></description>
      <pubDate>Fri, 20 Jul 2012 15:56:30 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Robert Basic's Blog: Using the new autoloaders from Zend Framework 1.12]]></title>
      <guid>http://www.phpdeveloper.org/news/18126</guid>
      <link>http://www.phpdeveloper.org/news/18126</link>
      <description><![CDATA[<p>
<i>Robert Basic</i> has a new post today about the <a href="http://robertbasic.com/blog/using-the-new-autoloaders-from-zend-framework-1-12">autoloaders in Zend Framework 1.12</a> and how to use them to create a classmap for use in your application.
</p>
<blockquote>
The latest, and last, release of the Zend Framework 1.x series is just around the corner as <a href="http://zend-framework-community.634137.n4.nabble.com/Zend-Framework-1-12-0RC1-Released-td4655323.html">ZF 1.12.0RC1 was announced this week</a>. As I still have projects running ZF1 I thought about giving the most interesting new feature (for me) a spin - the new autoloaders which are backported from ZF2. I decided using the classmap autoloader as the main autoloader, and the good ol' standard autoloader as the fallback autoloader. 
</blockquote>
<p>
He includes the changes to the Front Controller (index.php) to have it know about these new autoloaders and has a command that will go through your code any pull out any <a href="http://php.net/require_once">require_once</a> statements out and let the autoloader handle it instead.
</p>]]></description>
      <pubDate>Fri, 22 Jun 2012 08:17:05 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Propel Blog: The End of Autoloading]]></title>
      <guid>http://www.phpdeveloper.org/news/16103</guid>
      <link>http://www.phpdeveloper.org/news/16103</link>
      <description><![CDATA[<p>
On the Propel blog there's a recent post talking about how the <a href="http://propel.posterous.com/the-end-of-autoloading">age of autoloading might be ending</a> and how namespacing could be the next logical step (or could it).
</p>
<blockquote>
Autoloading in PHP is a great time saver. It lets you write concise scripts without the knowledge of the exact directory structure of the libraries you use. But with the arrival of namespaces in PHP 5.3, and the influence of Java over new generation PHP frameworks, autoloading is changing. In the near future, explicit autoloading will be ubiquitous, but with none of the advantages of the old style autoloading.
</blockquote>
<p>
He talks about "the old days" when things were included manually through file paths, how that graduated to the SPL autoloading and, most recently, up to namespace autoloading. He shares code samples of how the namespace loading works and how you can abuse it to override current classes/functionality with your own. He points out one interesting correlation though - that the "use" keyword seems a lot like the "require_once" of way back when. He shows how the added verbosity of namespace usage can be a hinderance on frameworks, citing microframeworks specifically and showing one implementation that's non-namespaced next to another that is.
</p>]]></description>
      <pubDate>Fri, 25 Mar 2011 11:13:51 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Smashing Magazine: Ask SM [PHP]: Form Validation, Converting MySQL to XML]]></title>
      <guid>http://www.phpdeveloper.org/news/11903</guid>
      <link>http://www.phpdeveloper.org/news/11903</link>
      <description><![CDATA[<p>
Smashing Magazine has started off a new feature of their site - an "Ask SM" where they gather questions their readers ask about different topics like CSS, Javascript and, of course, PHP. <a href="http://www.smashingmagazine.com/2009/02/05/ask-sm-php-questions/">This new post</a> is one such response. There's five quick questions answered in this new post:
</p>
<ul>
<li>Form validation with PHP
<li>Converting MySQL to XML
<li>require_once()-problem
<li>Search in different tables?
<li>Getting information out of an XML-file
</ul>
<blockquote>
Here at Smashing Magazine, we want to help out PHP programmers who are just getting started or who want to improve their programming chops. Our goal is to support our community by answering their questions and trying to find solutions to their problems.
</blockquote>
<p>
You can submit your questions in one of two ways - either <a href="http://forum.smashingmagazine.com/back-end-php-ruby-on-rails-f13/ask-sm-your-php-questions-please-t414.html">via their forum</a> or by sending a tweet (that's on <a href="http://twitter.com">Twitter</a> to him <a href="http://twitter.com/jasonatennui">@jasonatennui</a>.
</p>]]></description>
      <pubDate>Fri, 06 Feb 2009 13:48:11 -0600</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>
