<?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, 23 May 2013 09:28:19 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Sherif Ramadan: A Closer Look Into PHP Arrays: What You Don't See]]></title>
      <guid>http://www.phpdeveloper.org/news/18670</guid>
      <link>http://www.phpdeveloper.org/news/18670</link>
      <description><![CDATA[<p>
In a new post <i>Sherif Ramadan</i> takes an <a href="http://sheriframadan.com/2012/10/a-closer-look-into-php-arrays/">in-depth look at PHP arrays</a> and what happens behind the scenes when they're put to use. 
</p>
<blockquote>
PHP is one unique language where the array data type has been highly generalized to suit a very broad set of use cases. [...] I'm going to share with you some of the underlying details of how the PHP array data type works, why it works the way that it does, how it's different from other languages, and what behaviors the PHP array has that you may not be fully aware of.
</blockquote>
<p>
He starts with a section looking at what arrays actually are in PHP (and how they compare to the lower level C arrays). He gives a C-based array example and shows how it's <a href="http://sheriframadan.com/wp-content/uploads/2012/10/c-array.png">stored in memory</a>. He points out how PHP arrays are different from other languages and shows the C code that works behind the scenes to create the array (actually a hashtable). He gets into a detailed explanation of the iteration of arrays including some basic benchmarks of some of the various methods and gets more in-depth with <a href="http://php.net/foreach">foreach</a> (including subarrays and arrays containing references).
</p>]]></description>
      <pubDate>Mon, 29 Oct 2012 11:43:33 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[DZone.com: How to correctly work with PHP serialization]]></title>
      <guid>http://www.phpdeveloper.org/news/18416</guid>
      <link>http://www.phpdeveloper.org/news/18416</link>
      <description><![CDATA[<p>
In <a href="http://css.dzone.com/articles/how-correctly-work-php">this new post</a> to DZone.com today <i>Giorgio Sironi</i> takes a look at the serializing functionality in PHP and how it works with both regular variables and objects.
</p>
<blockquote>
PHP is able to automatically serialize most of its variables to strings - letting you save them into storage like $_SESSION. However, there are some tweaks you have to know to avoid exploding .php scripts and performance problems.
</blockquote>
<p>
He gives some code snippets showing the serialization of variables and objects and points out a few things that can't be effectively serialized (like resources and closures). The mentions the "__sleep" and "__wakeup" magic methods for automatic class serialization and mentions the <a href="http://php.net/Serializable"> Serializable</a> interface that comes built in to PHP.
</p>]]></description>
      <pubDate>Wed, 29 Aug 2012 08:19:37 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Gonzalo Ayuso: How to use environ variables to create different environments with PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/18403</guid>
      <link>http://www.phpdeveloper.org/news/18403</link>
      <description><![CDATA[<p>
<i>Gonzalo Ayuso</i> has a new post to his site showing how you can <a href="http://gonzalo123.wordpress.com/2012/08/27/deployment-tip-how-to-use-environ-variables-to-create-different-environments-with-php/">set up and use environment variables</a> to make different environments for your applications.
</p>
<blockquote>
If you use a framework such as Symfony2 this problem is solved for you, but if you aren't using any framework you probably need to solve it in one way or another. [...] The solution that I like for this kind of problem [with having different environments] is to use apache's environ variables. We inject the environ variables in the virtual host configuration.
</blockquote>
<p>
He shows how to add a variable to the VirtualHost section of your Apache config, how to use the <a href="http://php.net/getenv">getenv</a> function to retrieve its value and how to use it to select a configuration set. This method can also be applied to other kinds of information including settings you may not want to hard-code directly in you app (like possible database credentials).
</p>]]></description>
      <pubDate>Mon, 27 Aug 2012 07:49:29 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Evan Coury: Environment-specific configuration in Zend Framework 2]]></title>
      <guid>http://www.phpdeveloper.org/news/18249</guid>
      <link>http://www.phpdeveloper.org/news/18249</link>
      <description><![CDATA[<p>
<i>Evan Coury</i> has a new post looking at setting up <a href="http://blog.evan.pro/environment-specific-configuration-in-zend-framework-2">environment specific configurations</a> in a Zend Framework 2 application letting you switch between configs based on an environment variable.
</p>
<blockquote>
So you're all excited to try out ZF2. You <a href="http://blog.evan.pro/getting-started-with-the-zf2-skeleton-and-zfcuser">clone the skeleton, install some modules</a>, maybe even follow <a href="http://akrabat.com/zend-framework-2-tutorial/">Rob Allen's excellent ZF2 tutorial</a>, and finally, start building your application. Now, if you're a former ZF1 user or refugee from another framework, you might be troubled at this point by the fact that, at first glance, ZF2 doesn't appear to take into consideration environment-specific configuration values (e.g., development, testing, staging, production). Luckily, this is not the case!
</blockquote>
<p>
He includes a bit of sample code showing how you can use a simple <a href="http://php.net/getenv">getenv</a> call to pull in the value from an "APPLICATION_ENV" environment variable and put it into an autoload path.
</p>]]></description>
      <pubDate>Thu, 19 Jul 2012 11:36:06 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Anthony Ferrara: The Anatomy Of Equals - Opcode Analysis]]></title>
      <guid>http://www.phpdeveloper.org/news/18248</guid>
      <link>http://www.phpdeveloper.org/news/18248</link>
      <description><![CDATA[<p>
<i>Anthony Ferrara</i> has a new post today getting into the details of <a href="http://blog.ircmaxell.com/2012/07/the-anatomy-of-equals-opcode-analysis.html">how "equals" works in PHP</a> at the opcode level. He focuses on the answer to a question he received:
</p>
<blockquote>
I was asked an interesting question via email yesterday. The question is fairly simple. The answer, not so much... So, rather than reply in an email, I figured that I'd write a post about it instead. The question, simply stated, is: "When comparing a float to an integer using ==, where does the conversion happen?"
</blockquote>
<p>
He starts with a super simple piece of test code that compares an integer (1) to a float (1.0) and walks through the process PHP takes to perform the comparison (with a double equals "=="). He talks about opcode handlers, the "fast equal function" and how it handles the casting from one type to another, C source highlights included.
</p>]]></description>
      <pubDate>Thu, 19 Jul 2012 10:11:48 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPClasses.org: The Secret PHP Optimization of version 5.4]]></title>
      <guid>http://www.phpdeveloper.org/news/18094</guid>
      <link>http://www.phpdeveloper.org/news/18094</link>
      <description><![CDATA[<p>
In <a href="http://www.phpclasses.org/blog/post/187-The-Secret-PHP-Optimization-of-version-54.html">this new post</a> from <i>Manuel Lemos</i> on the PHPClasses.org blog about some of the performance enhancements that were introduced in the latest PHP releases (the 5.4.x series) including variable access optimization.
</p>
<blockquote>
PHP 5.4 introduced several performance optimizations. One of them was not discussed much in the PHP community but it may affect the performance of your code depending on the way you write it.
</blockquote>
<p>
He gets into some of the details surrounding the variable access optimization, pointing out how to get the most out of this improvement. He also does a bit of speculation about future versions of the language, including the possible introduction of <a href="http://www.phpclasses.org/blog/post/117-PHP-compiler-performance.html">"Just In Time" compilers</a>.
</p>]]></description>
      <pubDate>Thu, 14 Jun 2012 12:12:42 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Kevin Schroeder's Blog: Remote Debugging with the Zend Debugger and PHPUnit]]></title>
      <guid>http://www.phpdeveloper.org/news/17888</guid>
      <link>http://www.phpdeveloper.org/news/17888</link>
      <description><![CDATA[<p>
<i>Kevin Schroeder</i> has <a href="http://www.eschrade.com/page/remote-debugging-with-the-zend-debugger-and-phpunit/">a quick new post</a> with a one-liner you can use to get remote debugging working with Zend Debugger and PHPUnit.
</p>
<blockquote>
I'm trying to do some remote debugging with PHPUnit on a remote system.  I was following the rules I had <a href="http://www.eschrade.com/page/debugging-a-php-cli-script/">written about in a previous article</a> but for some reason I could not get path mapping to work.  So I figured I'd ping the Studio lead developer because as soon as I did that I'd get it to work.  Well, that's what happened. 
</blockquote>
<p>
His fix comes in the form of setting a command-line parameter, QUERY_STRING, with the correct parameter order so the paths will get mapped back to the correct project. This parameter is a URL-encoded set of parameters that do things like start the debugging, set up the hostname for the debugger to point to and map the "original URL" back to your choice of values.
</p>]]></description>
      <pubDate>Tue, 01 May 2012 09:27:47 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Project: Patchwork-Doc - JSON Formatted Output of PHP variables]]></title>
      <guid>http://www.phpdeveloper.org/news/16960</guid>
      <link>http://www.phpdeveloper.org/news/16960</link>
      <description><![CDATA[<p>
<i>Nicolas Grekas</i> has submitted about a new tool he's developed to "represent faithfully any PHP variable as complex as it is" - <a href="https://github.com/nicolas-grekas/Patchwork-Doc/blob/master/Dumping-PHP-Data-en.md">Patchwork-Doc</a> (related to his <a href="https://github.com/nicolas-grekas/Patchwork">Patchwork</a> PHP framework).
</p>
<blockquote>
The JSON format on which it rests guarantees maximum interoperability while ensuring good readability. The implementation done in the JsonDumper class operates all potentialities of the representation while providing maximum latitude to the developer to exploit its ability as desired, both in term of exposure of internal class mechanism for specialization and in terms of custom use, thanks to the callbacks that allow to intercept the JSON line by line and to adjust the dumping of objects or resources according to their type.
</blockquote>
<p>
It isn't required to use the framework to use this tool, however. You can see an example of the output format in <a href="https://github.com/nicolas-grekas/Patchwork-Doc/blob/master/Dumping-PHP-Data-en.md">this example</a> on the project's github page, complete with a guide to some of the advantages and disadvantages of some of the current, more common methods of output. Several types are included in the example including simple string/integer values, objects, classes, stream resources and the results of variable casting.
</p>]]></description>
      <pubDate>Thu, 06 Oct 2011 12:16:58 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Gonzalo Ayuso's Blog: Reflection over PHPDoc with PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/16143</guid>
      <link>http://www.phpdeveloper.org/news/16143</link>
      <description><![CDATA[<p>
<i>Gonzalo Ayuso</i> has a new post to his blog today talking about a regular expression-laden script he's some up with to <a href="http://gonzalo123.wordpress.com/2011/04/04/reflection-over-phpdoc-with-php/">reflect over a PHP file</a> and pull out the document's comments (PHPDoc-style).
</p>
<blockquote>
I want to parse PHPDoc code. Let me explain a little bit what I want to do. Imagine a dummy function documented with PHPDoc. [...] PHP has a great reflection API, but as at least in the current PHP version (as far as I know) we only can get the PHPDoc as a string, without parse it. I need to get the parameters and the type of them with reflection. [...] But the type is different. 
</blockquote>
<p>
His script (based loosely on a bit of a component from the <a href="http://framework.zend.com">Zend Framework</a>) parses the file and its comments and grabs the variable types from the PHPDoc blocks on each method and associates them.
</p>
<p>
If you're looking for a more mature solution than just this script, take a look at <a href="https://github.com/mvriel/Docblox">Docblox</a>, a PHP 5.3 documentation generator.
</p>]]></description>
      <pubDate>Mon, 04 Apr 2011 12:51:15 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Derick Rethans' Blog: Debugging Variables]]></title>
      <guid>http://www.phpdeveloper.org/news/15884</guid>
      <link>http://www.phpdeveloper.org/news/15884</link>
      <description><![CDATA[<p>
<i>Derick Rethans</i> has a new post to his blog today looking at a way you can dig inside of a variable that might be causing you trouble with the <a href="http://derickrethans.nl/debugging-variables.html">help of the debug_zval_dump method</a> - a PHP function that dumps a string representation of an internal zend value directly to the standard output method (usually an "echo").
</p>
<blockquote>
The internal representation of a PHP variable container (called zval), contains the type and value of a variable, but also whether it is a reference and what its refcount is. Due to PHP's copy-on-write policy, one specific zval container can be used by multiple variables at the same time as we will see in a bit.
</blockquote>
<p>
He talks about what the "refcount" field of a variable means and some simple examples showing a single reference, more than one symbols and how PHP handles a "split upon assignment". He also mentions Xdebug's method <a href="http://xdebug.org/docs/all_functions#xdebug_debug_zval">xdebug_debug_zval</a> that takes in a variable name rather than the variable itself.
</p>]]></description>
      <pubDate>Thu, 10 Feb 2011 09:26:18 -0600</pubDate>
    </item>
  </channel>
</rss>
