<?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 18:51:24 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Web Developer Juice: PHP Magic Functions: Best Part of Object Oriented PHP - Part 2]]></title>
      <guid>http://www.phpdeveloper.org/news/16361</guid>
      <link>http://www.phpdeveloper.org/news/16361</link>
      <description><![CDATA[<p>
Web Developer Juice has posted <a href="http://www.webdeveloperjuice.com/2011/05/09/php-magic-functions-best-part-of-object-oriented-php-%E2%80%93-part-2/">the second part of their series</a> looking at some of the "magic functions" that PHP has to offer - special functions that do automagic things in your scripts and classes. Part one can be <a href="http://phpdeveloper.org/news/16288">found here</a>.
</p>
<blockquote>
In my <a href="http://www.webdeveloperjuice.com/2011/04/28/php-magic-functions-best-part-of-object-oriente-php/">previous post</a> ( PHP Magic Functions ), I discussed about __construct, __destruct, __call and __callStatic. Lets explore a few more magic functions...
</blockquote>
<p>In this latest part of the series they look at three functions:</p>
<ul>
<li>__set/__get
<li>__invoke
</ul>]]></description>
      <pubDate>Thu, 19 May 2011 10:14:27 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Ole Markus' Blog: High load websites: A lock on Memcached::get]]></title>
      <guid>http://www.phpdeveloper.org/news/15640</guid>
      <link>http://www.phpdeveloper.org/news/15640</link>
      <description><![CDATA[<p>
<i>Ole Markus</i> has <a href="http://olemarkus.org/2010/12/high-load-websites-a-lock-on-memcachedget/">a new post</a> to his blog looking at a technique for working with memcached and fetching data out of the store using a binary semaphore for better performance.
</p>
<blockquote>
A typical document takes but a few hundred milliseconds to generate when a single request for the document enters the backend. The problem is that this is a highload website. In its current form, the backend serves hundreds of pages per second. This pretty much guarantees that the backend will concurrently receive cache miss on multiple languages and at the same time also receive cache miss on the pre-translated document.
</blockquote>
<p>
Given that he wants the translated version to be the one that's always shared, a problem can come up when the cache request is "missed" and the document starts generating from multiple places. His fix for the situation is that only the first miss generates and all others see a lock on it and wait for it to be removed before successfully fetching the result. He provides code in a "LockedMemcached" class to help make it all more useful.
</p>]]></description>
      <pubDate>Mon, 27 Dec 2010 12:34:14 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Manuel Pichler's Blog: Howto create custom rule sets for PHPMD]]></title>
      <guid>http://www.phpdeveloper.org/news/14329</guid>
      <link>http://www.phpdeveloper.org/news/14329</link>
      <description><![CDATA[<p>
If you've been using the <a href="http://phpmd.org/about.html">PHP Mess Detector (PHPMD)</a> to help clean up problem areas in your applications, but have needed more than just the basic rules that it comes with, you're in luck. <i>Manuel Pichler</i> has put together a new post for his blog about <a href="http://manuel-pichler.de/archives/84-Howto-create-custom-rule-sets-for-PHPMD.html">creating custom rules sets</a> for the tool.
</p>
<blockquote>
PHPMD can be seen as an one level down/low level equivalent to <a href="http://pear.php.net/package/PHP_CodeSniffer">PHP_CodeSniffer</a>. It is a simple command line tool that can be used to check your application's source code for possible bugs, suboptimal or overcomplicated code. The current release of <a href="http://phpmd.org/about.html">PHPMD</a> ships with three default rule sets. 
</blockquote>
<p>
The first deals with code size, the second checks for unused variables and the like and the third looks at naming conventions. He shows how to take one of the structures from one of these three and create a new rule. For his example it's a measurement of <a href="http://phpmd.org/rules/codesize.html#cyclomaticcomplexity">cyclomatic complexity</a>. He also shows you how to exclude certain rules that might come in another set so you don't have to completely redefine to use pre-existing rules.
</p>
<p>
The latest release of PHPMD can be pulled from <a href="http://pear.phpmd.org/">pear.phpmd.org</a> or from its <a href="http://github.com/manuelpichler/phpmd">github repository</a>.
</p>]]></description>
      <pubDate>Fri, 09 Apr 2010 13:19:25 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[DevShed: Handling MySQL Data Set Failures in PHP 5]]></title>
      <guid>http://www.phpdeveloper.org/news/11309</guid>
      <link>http://www.phpdeveloper.org/news/11309</link>
      <description><![CDATA[<p>
DevShed continues their look at custom exception handling in PHP5 application with this <a href="http://www.devshed.com/c/a/PHP/Handling-MySQL-Data-Set-Failures-in-PHP-5/">third part</a> of their series, a look at handling exceptions from MySQL calls.
</p>
<blockquote>
Having already introduced you to the main subject of this article series, it's time to summarize the topics that were discussed in the last article, in case you haven't read it yet. In that particular tutorial I explained how to implement a fully-functional customized exception system with PHP 5, which came in handy for handling a number of specific exceptions thrown by a basic MySQL abstraction class.
</blockquote>
<p>
They create a custom MySQL exception class that sits on top of their MySQL abstraction layer (and Result handling class) and catches exceptions thrown from sample queries.
</p>]]></description>
      <pubDate>Wed, 29 Oct 2008 13:35:39 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Jonathan Snook's Blog: Multiple Validation Sets in CakePHP 1.2]]></title>
      <guid>http://www.phpdeveloper.org/news/10661</guid>
      <link>http://www.phpdeveloper.org/news/10661</link>
      <description><![CDATA[<p>
<i>Jonathan Snook</i> has <a href="http://snook.ca/archives/cakephp/multiple_validation_sets_cakephp/">posted two methods</a> for creating multiple validation sets in the latest version of your <a href="http://www.cakephp.org">CakePHP</a> application.
</p>
<blockquote>
In CakePHP, you define how your data should be validated by setting parameters on the validate property of your model. In version 1.2, there is an on option that can be set on a specific rule that, when set, is either create or update. [...] Despite that, I developed a slightly different approach that allows for different validation sets to be specified and to be cleanly separated from each other.
</blockquote>
<p>
He overrides the validates() method with his own in a custom model in one of two ways - having the script check for a validation set for the current controller or by specifying it directly with a validationSet property. Code for both methods is included.
</p>]]></description>
      <pubDate>Wed, 23 Jul 2008 07:51:27 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Etienne Kneuss' Blog: SplFastArray to speed up your PHP arrays]]></title>
      <guid>http://www.phpdeveloper.org/news/10371</guid>
      <link>http://www.phpdeveloper.org/news/10371</link>
      <description><![CDATA[<p>
<i>Etienne Kneuss</i> has <a href="http://www.colder.ch/news/06-07-2008/33/splfastarray-to-speed-up-.html">posted about</a> a new part of the Standard PHP Library that creates arrays that are up to thirty percent faster than normal methods - SplFastArray.
</p>
<blockquote>
Antony got the idea to implement a C-like array wrapper in SPL: SplFastArray. The main advantage of that class is performance, it's indeed faster than PHP arrays. How so? No free lunch: The speedup comes from the fact that non-numeric indexes are not allowed and that the array is of fixed size.
</blockquote>
<p>
The code sample shows the setting of the size for the array (and changing it) with a var_dump of the output result. This method is always faster than normal arrays, it just varies how much from system to system (anywhere from ten to thirty percent).
</p>]]></description>
      <pubDate>Mon, 09 Jun 2008 12:54:04 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[DevShed: Working with Multiple Document Nodes with the DOM XML Extension in PHP 5]]></title>
      <guid>http://www.phpdeveloper.org/news/9818</guid>
      <link>http://www.phpdeveloper.org/news/9818</link>
      <description><![CDATA[<p>
DevShed has posted the <a href="http://www.devshed.com/c/a/PHP/Working-with-Multiple-Document-Nodes-with-the-DOM-XML-Extension-in-PHP-5/">fourth part</a> of their series looking at working with the DOM functionality of PHP5, this time with a focus on working with multiple document nodes inside of an XML document.
</p>
<blockquote>
It's time to learn a few other methods included with the DOM XML extension. Based upon this premise, in this fourth tutorial I'm going to show you how to get access to multiple nodes of an XML document, either for internal processing or simply for echoing to the browser.
</blockquote>
<p>
They show you how to <a href="http://www.devshed.com/c/a/PHP/Working-with-Multiple-Document-Nodes-with-the-DOM-XML-Extension-in-PHP-5/1/">grab the collection of nodes</a> to work with and how to grab data from an XML text file <a href="http://www.devshed.com/c/a/PHP/Working-with-Multiple-Document-Nodes-with-the-DOM-XML-Extension-in-PHP-5/2/">with load()</a> and <a href="http://www.devshed.com/c/a/PHP/Working-with-Multiple-Document-Nodes-with-the-DOM-XML-Extension-in-PHP-5/3/">loadXML()</a>.
</p>]]></description>
      <pubDate>Wed, 19 Mar 2008 07:59:49 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Matthew Weir O'Phinney's Blog: Overloading arrays in PHP 5.2.0]]></title>
      <guid>http://www.phpdeveloper.org/news/7129</guid>
      <link>http://www.phpdeveloper.org/news/7129</link>
      <description><![CDATA[<p>
In <a href="http://weierophinney.net/matthew/archives/131-Overloading-arrays-in-PHP-5.2.0.html">a new post</a> to his blog, <i>Matthew Weir O'Phinney</i> talks about a method for overloading arrays in a script written for the PHP 5.2 series.
</p>
<blockquote>
<p>
Several weeks back, a bug was reported against <a href="http://framework.zend.com/manual/en/zend.view.html">Zend_View</a> that had me initially stumped. [...] I'd read about this some months back on the php internals list, but at the time hadn't understood the consequences. 
</p>
<p>
Basically, __get() no longer returns a reference and returns values in read mode, which makes modifying arrays using overloading impossible using traditional methods.
</p>
</blockquote>
<p>
Unfortunately, this was exactly the functionality that was needed, so <i>Matthew</i> <a href="http://weierophinney.net/matthew/archives/131-Overloading-arrays-in-PHP-5.2.0.html">set out</a> to find a way to do just that. His initial method, extending the ArrayObject, worked but still gave errors. On <a href="http://mikenaberezny.com/">Mike Naberezny</a>'s recommendation, though, this too was resolved with a simple call to the __set method instead.
</p>]]></description>
      <pubDate>Sat, 19 Jan 2008 08:01:25 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Stuart Herbert's Blog: Quick Tip: Get, Set and Query in One Method]]></title>
      <guid>http://www.phpdeveloper.org/news/9232</guid>
      <link>http://www.phpdeveloper.org/news/9232</link>
      <description><![CDATA[<p>
On his blog, <i>Stuart Herbert</i> has <a href="http://blog.stuartherbert.com/php/2007/12/10/quick-tip-get-set-and-query-in-one-method/">a quick tip</a> showing how to mimic a feature of Ruby on Rails:
</p>
<blockquote>
I'm still working on the next article in my series looking at PHP on servers, so in the mean time, check out this simple way to emulate Ruby's nice way of handling separate getter, setter and state query methods in PHP.
</blockquote>
<p>
He admits <a href="http://blog.stuartherbert.com/php/2007/12/10/quick-tip-get-set-and-query-in-one-method/">his example</a> isn't as elegant as the Ruby method, but it does get the job done. Code for the method is included in his post ready for cut and pasting.
</p>]]></description>
      <pubDate>Wed, 12 Dec 2007 14:07:00 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Larry Garfield's Blog: Benchmarking magic]]></title>
      <guid>http://www.phpdeveloper.org/news/9005</guid>
      <link>http://www.phpdeveloper.org/news/9005</link>
      <description><![CDATA[<p>
<i>Larry Garfield</i> has <a href="http://www.garfieldtech.com/blog/magic-benchmarks">put together some benchmarks</a> based around a request he had from other developers (the "performance czars") as to how the magic functions in PHP5 would perform in the new environment.
</p>
<blockquote>
Already, there is talk of how, and if, to leverage PHP 5's object handling now that we don't need to deal with the weirdness of PHP 4's object model. Of course, because it's Drupal, our army of performance czars want to know just what the cost is for object handling, and especially advanced object magic like __get(), __call(), the ArrayAccess interface, and so forth.
</blockquote>
<p>
He an <a href="http://www.garfieldtech.com/blog/magic-benchmarks">his tests</a> on a Thinkpad (Intel Core2 Duo 2.2Ghz) running Kubuntu and PHP 5.2.3. They were run two million times benchmarking the different methods for:
<ul>
<li>function calls 
<li>__call
<li>__get
<li>__set
<li>iterators (array)
<li>inheritance
<li>composition
</ul>
<p>
His results are listed at the <a href="http://www.garfieldtech.com/blog/magic-benchmarks">end of the post</a>.
</p>]]></description>
      <pubDate>Thu, 08 Nov 2007 12:04:00 -0600</pubDate>
    </item>
  </channel>
</rss>
