<?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, 19 Mar 2010 07:37:32 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Jani Hartikainen's Blog: Should a failed function return a value or throw an exception?]]></title>
      <guid>http://www.phpdeveloper.org/news/14173</guid>
      <link>http://www.phpdeveloper.org/news/14173</link>
      <description><![CDATA[<p>
<i>Jani Hartikainen</i> poses an interesting question on his blog today - is it more correct for a function, having failed at its job, to <a href="http://codeutopia.net/blog/2010/03/11/should-a-failed-function-return-a-value-or-throw-an-exception/">return a value of throw an exception</a>.
</p>
<blockquote>
You have created a nice, well written function, but you realize you forgot something: The failure case. What should a function do when it fails? There are two schools for this - the "throw an exception" school and the "return an error value" school. But which of these is the correct approach?
</blockquote>
<p>
He suggests that this debate has stuck around from the time when there weren't exceptions in several popular programming languages and that returning the value was the only valid way. He touches on what an exception condition is (with a few code examples) and situations where each choice might be the right way to go. 
</p>]]></description>
      <pubDate>Fri, 12 Mar 2010 10:41:43 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Eli White's Blog: An intriguing use of lambda functions]]></title>
      <guid>http://www.phpdeveloper.org/news/14166</guid>
      <link>http://www.phpdeveloper.org/news/14166</link>
      <description><![CDATA[<p>
In a new post to his blog today <i>Eli White</i> takes a look at an <a href="http://eliw.wordpress.com/2010/03/10/an-intriguing-use-of-lambda-functions/">interesting use of lambda functions</a> he's figured out for a his <a href="http://goodsie.com/">development at work</a>.
</p>
<blockquote>
I found a very specific use out of the blue of Lambda functions that I have now used and I see as a great use-case. Which is specifically passing functions/logic from your Controller to your View. In the case of Goodsie, I'm using PHP for my templating language and as usual I'm trying to remove as much logic from my View as possible, while still allowing the view to be malleable.
</blockquote>
<p>
His method centered around a pagination subview that he wanted to make flexible enough to work with both the standard page view and with an ajax request. Lambda functions came to the rescue by dynamically creating a function based on the request need. 
</p>]]></description>
      <pubDate>Thu, 11 Mar 2010 08:48:16 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Brandon Savage's Blog: Cool DateTime Functions In PHP 5.3]]></title>
      <guid>http://www.phpdeveloper.org/news/13900</guid>
      <link>http://www.phpdeveloper.org/news/13900</link>
      <description><![CDATA[<p>
<i>Brandon Savage</i> has <a href="http://www.brandonsavage.net/cool-datetime-functions-in-php-5-3/">posted about</a> some interesting things he's come across when working with the DateTime objects in PHP 5.3 including working with timestamps and differences in terms of days/months/etc.
</p>
<blockquote>
Over time, the PHP DateTime object has become one of the best objects available to PHP developers. This object has grown since early PHP 5 into a robust class that has the ability to do lots of great things. Recently, I was exploring some of the functionality provided by the DateTime object as of PHP 5.3 (and wishing that Ubuntu had PHP 5.3 as a package distribution). Here are some of the new things in PHP 5.3 that are really cool.
</blockquote>
<p>
He mentions the "add()" and "sub()" methods you can use on an object to get information about the dates/times forward and backwards, the "diff()" to get the differences between two dates and the get/setTimestamp methods to get the current time (or set it).
</p>]]></description>
      <pubDate>Mon, 25 Jan 2010 10:13:31 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Brendon's Blog: 10 PHP functions you (probably) never use]]></title>
      <guid>http://www.phpdeveloper.org/news/13851</guid>
      <link>http://www.phpdeveloper.org/news/13851</link>
      <description><![CDATA[<p>
New from his blog <i>Brendon</i> has a list of what he thinks are <a href="http://infinity-infinity.com/2009/07/10-php-functions-you-probably-never-use/">ten PHP functions you'll never use</a>.
</p>
<blockquote>
When scripting in PHP, we often restrict ourselves to a limited number of API functions: the common ones, like print(), header(), define(), isset(), htmlspecialchars(), etc. [...] The PHP API actually offers a lot of functionality, some useless and some useful; often seldom used. I have been looking through the available functions and was interested to find some really cool functions that I should have known about.
</blockquote>
<p>
Here's his list of functions, some of which are more on the "special needs" list than the "never use" list:
</p>
<ul>
<li><a href="http://php.net/sys_getloadavg">sys_getloadavg</a>
<li><a href="http://php.net/pack">pack</a>
<li><a href="http://php.net/cal_days_in_month">cal_days_in_month</a>
<li><a href="http://php.net/gettext">_()</a>
<li><a href="http://php.net/get_browser">get_browser</a>
<li><a href="http://php.net/debug_print_backtrace">debug_print_backtrace</a>
<li><a href="http://php.net/metaphone">metaphone</a>
<li><a href="http://php.net/natsort">natsort</a>
<li><a href="http://php.net/levenshtein">levenshtein</a>
<li><a href="http://php.net/glob">glob</a>
</ul>]]></description>
      <pubDate>Fri, 15 Jan 2010 11:27:57 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Alexey Zakhlestin's Blog: Ode to mb_ereg functions ]]></title>
      <guid>http://www.phpdeveloper.org/news/13602</guid>
      <link>http://www.phpdeveloper.org/news/13602</link>
      <description><![CDATA[<p>
<i>Alexey Zakhlestin</i> has <a href="http://blog.milkfarmsoft.com/2009/11/ode-to-mb_ereg-functions/">written an ode</a> to the mb_ereg functions - a set of regular expression based functions that are more than just for unicode strings:
</p>
<blockquote>
There is a common misunderstanding, that mb_ereg_* functions are just unicode counterparts of ereg_* functions: slow and non-powerful. That's as far from truth as it can be. mb_ereg_* functions are based on <a href="http://www.geocities.jp/kosako3/oniguruma/">oniguruma</a> regular expressions library. And oniguruma is one of the fastest and most capable regular expression libraries out there. Couple of years ago I made a little <a href="http://blog.milkfarmsoft.com/2006/12/regexps-in-php-again/">speed-test</a>.
</blockquote>
<p>
He talks about some of the options you can give it (ignore case, find-longest, multiline) and modes (grep, java, perl, etc). A few code examples are also included.
</p>]]></description>
      <pubDate>Mon, 30 Nov 2009 14:38:52 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Brandon Savage's Blog: Five Cool PHP Array Functions]]></title>
      <guid>http://www.phpdeveloper.org/news/13415</guid>
      <link>http://www.phpdeveloper.org/news/13415</link>
      <description><![CDATA[<p>
In a new post to his blog <i>Brandon Savage</i> <a href="http://www.brandonsavage.net/five-cool-php-array-functions/">takes a look at</a> five different functions for working with arrays you can do some pretty cool things with:
</p>
<blockquote>
Time and time again, I come across code that contains a variety of array-handling functions that too often duplicate the work that the PHP core team has done to develop built-in array functions. Since the built-in functions are inherently faster, trying to reimplement them in PHP will inevitably be a performance problem.
</blockquote>
<p>The five functions he covers are:</p>
<ul>
<li><A href="http://php.net/array_key_exists">array_key_exists</a>
<li><A href="http://us3.php.net/manual/en/function.usort.php">usort</a>
<li><a href="http://us3.php.net/manual/en/function.array-pop.php">array_pop</a>
<li><a href="http://us3.php.net/manual/en/function.array-merge.php">aray_merge</a>
<li><a href="http://us3.php.net/manual/en/function.array-rand.php">array_rand</a>
</ul>]]></description>
      <pubDate>Wed, 21 Oct 2009 08:19:55 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Brandon Savage's Blog: How To Write A Function In PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/13388</guid>
      <link>http://www.phpdeveloper.org/news/13388</link>
      <description><![CDATA[<p>
Continuing in his introductory series of posts <i>Brandon Savage</i> has added <a href="http://www.brandonsavage.net/how-to-write-a-function-in-php/">this new tutorial</a> to his blog introducing and showing how to work with functions.
</p>
<blockquote>
For new developers, especially developers who have never been programmers before, moving from writing simple scripts to writing functions is a process that takes time. I developed in PHP for years before I wrote a single function. I also never found a comprehensive tutorial on how functions work, or how to write them. There's documentation in the manual, but it's a bit hard to grasp if you're new.
</blockquote>
<p>
He looks at what they are, how they're used and some of the more technical details like scoping, optional arguments, using globals and passing values by reference.
</p>]]></description>
      <pubDate>Wed, 14 Oct 2009 11:12:46 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Recess Blog: Functional PHP 5.3 Part I - What are Anonymous Functions and Closures?]]></title>
      <guid>http://www.phpdeveloper.org/news/13070</guid>
      <link>http://www.phpdeveloper.org/news/13070</link>
      <description><![CDATA[<p>
Those still trying to get a handle on anonymous functions, lambdas and closures in the recently released 5.3 version of PHP might want to take a look at <a href="http://www.recessframework.org/page/functional-php-anonymous-functions-lambdas-closures">this new tutorial</a> from the Recess blog. It's the first part of their "Functional PHP 5.3" series.
</p>
<blockquote>
One of the most exciting features of PHP 5.3 is the first-class support for <a href="http://us.php.net/manual/en/functions.anonymous.php">anonymous functions</a>. You may have heard them referred to as <a href="http://us.php.net/manual/en/functions.anonymous.php">closures</a> or lambdas as well. There's a lot of meaning behind these terms so let's straighten it all out.
</blockquote>
<p>
They explain the differences between closures and lambda functions (hint: not much) and give code examples for both them and closures.
</p>]]></description>
      <pubDate>Wed, 19 Aug 2009 11:56:50 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Cal Evans' Blog: Quickie Zend Framework Bootstrap Note]]></title>
      <guid>http://www.phpdeveloper.org/news/13040</guid>
      <link>http://www.phpdeveloper.org/news/13040</link>
      <description><![CDATA[<p>
<i>Cal Evans</i> has posted <a href="http://blog.calevans.com/2009/08/13/quickie-zend-framework-bootstrap-note/">a Zend Framework quickie</a> for working with the bootstrap in your application.
</p>
<blockquote>
I've been teaching a <a href="http://framework.zend.com/">Zend Framework</a> class this week and my students have been throwing all kinds of questions at me. Most recently, while we were discussing creating a Bootstrap class for an application a question came up about the _init* functions.
</blockquote>
<p>
The documentation talks about the bootstrap loading those init functions, but it leaves out the order they're executed in. <i>Cal</i> did a bit of research and found that they're executed in the order they're created with one exception - if you specify one to run first in the bootstrap constructor.
</p>]]></description>
      <pubDate>Thu, 13 Aug 2009 13:25:14 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[DevShed: The Destruct Magic Function in PHP 5]]></title>
      <guid>http://www.phpdeveloper.org/news/12742</guid>
      <link>http://www.phpdeveloper.org/news/12742</link>
      <description><![CDATA[<p>
DevShed has posted the <a href="http://www.devshed.com/c/a/PHP/The-Destruct-Magic-Function-in-PHP-5/">second to last part</a> of their tutorial series looking at the magic functions in PHP. This time they focus on the destruct function, a method that is fired off when an object is being removed from memory.
</p>
<blockquote>
There are a few [other methods] that can be really useful for performing relatively complex tasks with a minimal amount of code. That's exactly the case with the "__destruct()" method, which will be called automatically by the PHP engine before destroying an instance of a particular class at the end of a script. 
</blockquote>
<p>
They update their <a href="http://www.devshed.com/c/a/PHP/The-Destruct-Magic-Function-in-PHP-5/2/">example class</a> with a new __destruct method that takes the user information inserted previously, serializes it and drops it into the current session.
</p>]]></description>
      <pubDate>Wed, 24 Jun 2009 08:46:18 -0500</pubDate>
    </item>
  </channel>
</rss>
