<?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>Thu, 20 Jun 2013 05:07:38 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Lorna Mitchell's Blog: Callbacks in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/15902</guid>
      <link>http://www.phpdeveloper.org/news/15902</link>
      <description><![CDATA[<p>
<i>Lorna Mitchell</i> has a new post to her blog today looking at a very handy piece of PHP functionality sprinkled around in different functions - <a href="http://www.lornajane.net/posts/2011/Callbacks-in-PHP">using callbacks</a> to handle complicated processing.
</p>
<blockquote>
Recently I was working on something and I wanted to call an object method as a callback, but got confused when I realised the method had been caused statically. This was caused by my inability to RTFM and I wondered how I'd come so far without actually coming across the many and varied things you can pass into any place a callback is needed.
</blockquote>
<p>
Besides the normal callback functions you can put in something like <a href="http://php.net/call_user_func">call_user_func</a>, she also mentions something a bit more powerful - passing in an array that contains a pointer to an object and a method inside it. <a href="http://uk2.php.net/manual/en/language.pseudo-types.php#language.types.callback">This ability</a> allows you to keep your OOP encapsulation intact without having to make global functions. In PHP 5.3, there's even some of the PHP functions that use call backs that will allow you to use <a href="http://www.php.net/manual/en/functions.anonymous.php">closures/anonymous functions</a> without even having to make a separate function.
</p>]]></description>
      <pubDate>Mon, 14 Feb 2011 13:41:28 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[SitePoint PHP Blog: Dynamic global functions in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/8879</guid>
      <link>http://www.phpdeveloper.org/news/8879</link>
      <description><![CDATA[<p>
On the SitePoint PHP blog, there's a <a href="http://www.sitepoint.com/blogs/2007/10/21/dynamic-global-functions-in-php/">quick tutorial</a> from <i>Troels Knak-Nielsen</i> about the creation and use of dynamic global functions in your PHP application:
</p>
<blockquote>
Like many others, I prefer to use procedural PHP as a template language. While PHP's syntax makes it a practical choice for this, there is a problem with embedding dynamic content. [...] A single letter, regular function is undoubtedly the simplest way to extend PHP's syntax. Thinking about it, it's fairly obvious, but it just never occurred to me. [...] There is a problem though; Since this is such a good name for a function, chances are that someone else would use it for something different, or perhaps even for the same.
</blockquote>
<p>
As a more viable solution, he recommends <a href="http://www.sitepoint.com/blogs/2007/10/21/dynamic-global-functions-in-php/">going dynamic</a> and creating fumctions (via the call_user_func_* functions) and an addition to the $GLOBALS superglobal to make calling the custom function simpler.
</p>]]></description>
      <pubDate>Mon, 22 Oct 2007 11:12:00 -0500</pubDate>
    </item>
  </channel>
</rss>
