<?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, 25 Jul 2008 09:33:32 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Debuggable Blog: How to bend Cake's Model::find() method to your needs]]></title>
      <guid>http://www.phpdeveloper.org/news/10463</guid>
      <link>http://www.phpdeveloper.org/news/10463</link>
      <description><![CDATA[<p>
New on the Debuggable blog, <i>Tim Koschutzki</i> has <a href="http://www.debuggable.com/posts/implementing-different-types-for-cake%27s-model::find()-method:485030de-4778-456e-8400-44d84834cda3">posted a method</a> to get the fund() method in the CakePHP framework's models to bend to your will.
</p>
<blockquote>
CakePHP allows you to use your own "find-types" for the Model::find() methodology. Those of your who are familiar with the find() method know that there are currently four types in the core: 'list', 'all', 'first' and 'count'. However, sometimes it is nice to specify your own type.
</blockquote>
<p>
He shows an example of the end result - a find() call with a custom type that automagically gets translated correctly. His script overrides and enhances the usual find call in an extended object (extended from AppModel) that uses a switch/case statement to define the custom types and their find() search calls.
</p>]]></description>
      <pubDate>Mon, 23 Jun 2008 12:08:32 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[SitePoint WebTech Blog: Give Your Visitors a Rough Time]]></title>
      <guid>http://www.phpdeveloper.org/news/9744</guid>
      <link>http://www.phpdeveloper.org/news/9744</link>
      <description><![CDATA[<p>
In <a href="http://www.sitepoint.com/blogs/2008/03/06/give-you-visitors-a-rough-time/">a new post</a> to the Web Tech blog over on SitePoint, <i>Toby Somerville</i> has posted something he calls "RoughTime" - his method for displaying a more "human friendly" output of a timestamp.
</p>
<blockquote>
When asked the time, we generally don't need to be military accurate with our response [...] we generally communicate the approximate time. i.e. 'its nearly ten' or 'its just gone half past three'. Yet on the web, time is generally shown as '12:24:13 AM', or similar â€" not very visitor friendly.
</blockquote>
<p>
His <a href="http://www.sitepoint.com/blogs/2008/03/06/give-you-visitors-a-rough-time/">RoughTime</a> uses two switch statements to map the hour and minute values to different strings. For example, minutes between 15 and 20 become "quarter past" and the hours are changed over from numeric versions to their word counterparts.
</p>]]></description>
      <pubDate>Thu, 06 Mar 2008 08:44:00 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Rob Thompson's Blog: Switch vs. If]]></title>
      <guid>http://www.phpdeveloper.org/news/9549</guid>
      <link>http://www.phpdeveloper.org/news/9549</link>
      <description><![CDATA[<p>
<i>Rob Thompson</i> has <a href="http://rob.sun3.org/php-code/switch-vs-if/">posted about</a> some simple benchmarking he did comparing the speed of a series of "if" statements versus one "switch" with multiple cases.
</p>
<blockquote>
I got curious about which is actually more efficient at matching a random integer with a set of conditionals. So, I setup a script to create a set of large scripts to test the speed of these different constructs. Using the 'time' command, I measured the speed at which the condition could match a random number.
</blockquote>
<p>
His results found that the switch statement is generally more than 2 times as fast at matching a simple integer. His tests, however, didn't go through much more than this simple test. It'd be interesting to see what it would do with something more complex (like longer strings or handling the result of an evaluation inside the definition of the switch().
</p>]]></description>
      <pubDate>Fri, 01 Feb 2008 14:28:00 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[DevShed: The Switch Statement and Arrays]]></title>
      <guid>http://www.phpdeveloper.org/news/9368</guid>
      <link>http://www.phpdeveloper.org/news/9368</link>
      <description><![CDATA[<p>
DevShed continues their series looking at some of the fundamentals of working with PHP in <a href="http://www.devshed.com/c/a/PHP/PHP-The-Switch-Statement-and-Arrays/">this new tutorial</a> posted today. It looks at one of the flow control statements the language has to offer and a very useful data structure - the switch statement and arrays.
</p>
<blockquote>
In our last exciting adventure (back in early November), we braved crocodiles, ravenous editors, most of the PHP statements, and beginning loops. In this edition we'll cover the final statement, the Switch, and discuss arrays. So sit back, order your R2D2 robot to bring you a cold, frosty Jolt Cola, and let's get cracking.
</blockquote>
<p>
They start with a simple example of a switch statement (to echo out strings) and follow it with a detailed description of the different sorts of arrays - numeric indexed, associative and multidimensional versions. 
</p>]]></description>
      <pubDate>Mon, 07 Jan 2008 12:50:00 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Soledad Penades' Blog: Signs your PHP needs refactoring]]></title>
      <guid>http://www.phpdeveloper.org/news/7980</guid>
      <link>http://www.phpdeveloper.org/news/7980</link>
      <description><![CDATA[<p>
As <a href="http://feeds.feedburner.com/~r/funkablog/~3/122396798/">mentioned by</a> <i>Ed Finkler</i>, there's a list of <a href="http://www.soledadpenades.com/2007/06/05/signs-your-php-needs-refactoring/">signs your PHP needs refactoring</a> from <i>Soledad Penades</i>.
</p>
<blockquote>
<p>
I have had to go through a php application recently which has given me more than one headache and has required me to use all my possible patience. While working with it, I thought This is good material for an article, so that nobody else does the same in the future, and nobody else will need to experience the same displeasure as I have had to.
</p>
<p>
So here are the signs your PHP application needs a serious refactoring, right now
</p>
</blockquote>
<p>
Included in <a href="http://www.soledadpenades.com/2007/06/05/signs-your-php-needs-refactoring/">the list</a> are things like:
</p>
<ul>
<li>Uses global variables
<li>Everything's an array
<li>The neverending switch
<li>Interface inconsistency
</ul>
<p>
It hits on one of the thing that bugs me too, the problem of "Brackets galore" - so many subarrays that you have to resort to three or more sets of bracketed keys to get to the value you want. It's bad enough trying to follow someone else's code without having to "trace down" an array to figure out which of the values they're talking about.
</p>]]></description>
      <pubDate>Tue, 05 Jun 2007 16:26:00 -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/6993</guid>
      <link>http://www.phpdeveloper.org/news/6993</link>
      <description><![CDATA[<p>
<i>Matthew Weir O'Phinney</i> has a new post on his blog today talking about <a href="http://weierophinney.net/matthew/archives/131-Overloading-arrays-in-PHP-5.2.0.html">overloading arrays</a> in PHP 5.2.0 using the magic __get and __construct functions.
</p>
<blockquote>
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. [...] Basically, __get() no longer returns a reference and returns values in read mode, which makes modifying arrays using overloading impossible using traditional methods.
</blockquote>
<p>
He <a href="http://weierophinney.net/matthew/archives/131-Overloading-arrays-in-PHP-5.2.0.html">gives a code example</a> of the problem and two ways to get around it - one using a switch statement to get around the problem and the other ("best solution") was <i>Matthew</i>'s option to extend the ArrayObject class.
</p>]]></description>
      <pubDate>Fri, 29 Dec 2006 07:33:00 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[SitePoint Ruby on Rails Blog: PHP developers most likely to switch to Rails]]></title>
      <guid>http://www.phpdeveloper.org/news/6449</guid>
      <link>http://www.phpdeveloper.org/news/6449</link>
      <description><![CDATA[<p>
<i>Matthew Magain</i> has some <a href="http://www.sitepoint.com/blogs/2006/10/09/php-developers-most-likely-to-switch-to-rails/">interesting observations</a> over on the SitePoint Ruby on Rails blog today - specifically that PHP developers are the most likely (out of those working with other web-based languages out there) to make the switch to Ruby on Rails.
</p>
<blockquote>
<p>
Of all the graphs in <a href="http://www.sitepoint.com/reports/reportwebsurvey2006/">The State of Web Development 2006/2007</a> report that SitePoint and Ektron published recently, the one that stood out the most to me was the one showing the platform currently being used by developers planning to start using Ruby on Rails.
</p>
<p>
It wasn't the fact that the graph shows PHP developers to be likely to start using Rails-this makes sense, as someone is more likely to experiment with another open source platform if they're already using another open source platform-it was the fact that PHP developers are more than three times as likely to start using Rails, even more so than Java developers!
</p>
</blockquote>
<p>
Unfortunately, the <a href="http://www.sitepoint.com/blogs/2006/10/09/php-developers-most-likely-to-switch-to-rails/">study mentioned</a> isn't too cheap, otherwise it would be interesting to see the info behind this graph....
</p>]]></description>
      <pubDate>Mon, 09 Oct 2006 08:06:49 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Matthew Weir O'Phinney's Blog: Cgiapp2 Tutorial 1 - Switch Template Plugins at Will]]></title>
      <guid>http://www.phpdeveloper.org/news/5517</guid>
      <link>http://www.phpdeveloper.org/news/5517</link>
      <description><![CDATA[<p>
Right on the tails of a new release of the <a href="http://weierophinney.net/phly/index.php?package=Cgiapp2">Cgiapp set of libraries</a>, <i>Matthew Weir O'Phinney</i> has posted <a href="http://weierophinney.net/matthew/archives/117-Cgiapp2-Tutorial-1-Switch-Template-Plugins-at-Will.html">a first tutorial</a> in a series covering its usage. In this tutorial, he looks at a creating a "template switcher" for Cgiapp2-based applications.
</p>
<quote>
<i>
<p>
Cgiapp2 implements a new callback hook system, which is basically an <a href="http://en.wikipedia.org/wiki/Observer_pattern">Observer pattern</a>. Cgiapp2 has a number of registered hooks to which observers can attach; when a hook is triggered, each observer attached to it is notified and executed.
</p>
<p>
Why all this talk about hooks? Because in Cgiapp2, the various template actions -- initialization, variable assignment, and rendering -- are relegated to hooks. For simplicity's sake, and for backward compatibility, you can use the functions tmpl_path(), tmpl_assign(), and load_tmpl() to invoke them; you could also use the generic call_hook() method to do so, passing the hook name as the first argument.
</p>
</i>
</quote>
<p>
To make it simpler for developers to access this templating system, <i>Matthew</i> created the <a href="http://weierophinney.net/phly/darcs/annotate/cgiapp/Cgiapp2/Plugin/Template/Interface.class.php">Cgiapp2_Plugin_Template_Interface</a>, a standardized interface for the template plugins. It's this interface that he demonstrated an example of, giving only a few lines of code (all that's needed) to switch between Smarty and Savant templating systems.
</p>]]></description>
      <pubDate>Tue, 06 Jun 2006 05:47:28 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Kian Hui Teo's Blog:  Switching between PHP 5.1.x and Zend Core for Oracle]]></title>
      <guid>http://www.phpdeveloper.org/news/5420</guid>
      <link>http://www.phpdeveloper.org/news/5420</link>
      <description><![CDATA[<p>
Via <a href="http://blogs.oracle.com/opal/2006/05/22#a35">this post</a> from <i>Christopher Jones</i> we learn about <i>Kian Hui Teo</i>'s <a href="http://kayneteo.blogspot.com/2006/05/switching-between-php-51x-and-zend_16.html">blog post</a> talking about making the switch between the normal PHP 5.1.x installation and the Zend Core for Oracle.
</p>
<quote>
<i>
This situation arises as I had installed Zend Core for Oracle (ZCO), and I wanted to try out some PDO functions. As ZCO comes with PHP 5.0.5, I was stuck, and PDO is only included from PHP 5.1.x onwards, I had to install PHP 5.1.x on my Windows box so that I can play with PDO. The assumption is that we have ZCO installed and working with a Apache2 server. I share the steps here on how to install another version of PHP so that it will co-exist peacefully with ZCO.
</i>
</quote>
<p>
<a href="http://kayneteo.blogspot.com/2006/05/switching-between-php-51x-and-zend_16.html">The post</a> outlines a process to allow both the Zend Core and a normal installation of PHP 5.1.x to live peacefully (and still be able to switch from one to the other at any time). It's actually a relatively simple ten-step process to follow, especially if you've had much experience with installing PHP from scratch. When complete, you can start up one or the other, making it easy to test scripts in both or to just use the functionality in one (as he needed with PDO). 
</p>]]></description>
      <pubDate>Mon, 22 May 2006 17:46:32 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Matthew Batchelder's Blog: Writing Your Server-Side Ajax Handler]]></title>
      <guid>http://www.phpdeveloper.org/news/5038</guid>
      <link>http://www.phpdeveloper.org/news/5038</link>
      <description><![CDATA[<i>Matthew Batchelder</i> describes in <a href="http://borkweb.com/story/a-simple-server-side-ajax-handler">his latest post</a> about the other half of an equation he demonstrated in <a href="http://borkweb.com/story/ajax-templating-and-the-separation-of-layout-and-logic">this previous post</a> - the creation of an Ajax handler.
<p>
<quote>
<i>
In my recent post on '<a href="http://borkweb.com/story/ajax-templating-and-the-separation-of-layout-and-logic">Ajax; Templating; and the Separation of Layout and Logic</a>,' I refer to an Ajax Handler that sits server side to handle Ajax calls. Some elaboration is in order.
<p>
As I have <a href="http://borkweb.com/story/prototype-makes-javascript-painless">stated in the past</a>, I'm a huge fan of <a href="http://prototype.conio.net/">Prototype</a> AND I choose <a href="http://php.net/">PHP</a> as my language of choice...so my examples will be using both, but the idea is portable.
</i>
</quote>
<p>
His <a href="http://borkweb.com/story/a-simple-server-side-ajax-handler">example</a> is a very basic one, pulling in the data from the $_GET values and, with a combination of dynamic function calls and the use of eval(), provides a simple "framework" to handle your Ajax calls. There are two versions of the same thing - one using if statements and the other a switch and various cases.]]></description>
      <pubDate>Thu, 23 Mar 2006 12:37:17 -0600</pubDate>
    </item>
  </channel>
</rss>
