<?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, 24 May 2012 19:06:22 -0500</pubDate>
    <ttl>30</ttl>
    <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>
    <item>
      <title><![CDATA[Till Klampaeckel's Blog: Zend Framework: Writing an IN-Clause with Zend_Db]]></title>
      <guid>http://www.phpdeveloper.org/news/15612</guid>
      <link>http://www.phpdeveloper.org/news/15612</link>
      <description><![CDATA[<p>
In <a href="http://till.klampaeckel.de/blog/archives/129-Zend-Framework-Writing-an-IN-Clause-with-Zend_Db.html">a new post</a> to his blog <i>Till Klampaeckel</i> looks at something the Zend Framework's Zend_Db component dosen't seem to support - an "IN" on a fetchAll - and how he worked around it.
</p>
<blockquote>
The IN-clause is only supported when I wrap my statement with Zend_Db_Select, which is something I rarely do. Part of the reason is that I still don't feel comfortable writing my SQL in a DSL which doesn't really do anything besides wrapping a string into an object and IMHO it doesn't add to readability either. And the other reason is that I don't plan to run this import against any other database than MySQL. Which is why I don't see the need for abstraction either.
</blockquote>
<p>
He shows some failing code where the IN isn't populated correctly when an array is passed in and the warnings that come with it. He solution's pretty simple, though - rewrite the query string before sending it with the correct number of bind locations ("?") for the number of parameters. In the comments, other approaches are suggested including using a simple select() call or tricking the bindings with a special kind of array. 
</p>]]></description>
      <pubDate>Tue, 21 Dec 2010 13:16:07 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Reddit.com: Today I learned about variable variables...]]></title>
      <guid>http://www.phpdeveloper.org/news/15316</guid>
      <link>http://www.phpdeveloper.org/news/15316</link>
      <description><![CDATA[<p>
Over on Reddit.com there's an interesting post (yes, despite some of the comments made on it) about variable variables that turns into a <a href="http://www.reddit.com/r/programming/comments/dst56/today_i_learned_about_php_variable_variables/c12np38">detailed look at PHP variable handling</a> as based around "$".
</p>
<blockquote>
OK, here's the thing: [variable variables are] only the entrance of the rabbit hole. [...] The first thing to understand is what $ is. $ is actually a shorthand for ${} and means "return the value of the variable whose name is contained in this".
</blockquote>
<p>
The response goes on to talk about variable names as strings, a few string handling tricks that can be used when referencing them and how this works with objects too. Things get a bit more complicated when they start adding in more levels of "variable" and evaluations based on random results. Not overly useful information for the casual developer, but interesting to know none the less.
</p>]]></description>
      <pubDate>Thu, 21 Oct 2010 12:05:30 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Sameer Borate's Blog: Raw vs. cooked PHP $_POST variables]]></title>
      <guid>http://www.phpdeveloper.org/news/15155</guid>
      <link>http://www.phpdeveloper.org/news/15155</link>
      <description><![CDATA[<p>
<i>Sameer Borate</i> as a new post to his blog today looking at <a href="http://www.codediesel.com/php/raw-vs-cooked-php-post-variables/">some of the quirks</a> he's found when dealing with the $_POST superglobal in PHP.
</p>
<blockquote>
A little quirk of PHP $_POST var I encountered while fixing a Salesforce web-to-Lead bug. A Wordpress site was using a form to submit user requests to the Salesforce web-service. The form that submitted the data had the following fields along with the others. The problem was with the multi-select field, only the last value selected in the multi-select was getting captured.
</blockquote>
<p>
He investigated and found that his code was echoing out all of the values, but wasn't using the "field_name[]" notation with the square brackets to send back multiple values to PHP. Changing this and trying again, he noticed it still wasn't working as expected (with Salesforce). He figured out they're using "raw" versus "cooked" handling of the POSTed variables. Check out the <a href="http://www.codediesel.com/php/raw-vs-cooked-php-post-variables/">rest of his post</a> to find out what that means.
</p>]]></description>
      <pubDate>Mon, 20 Sep 2010 10:15:16 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Derick Rethans' Blog: Collecting Garbage: PHP's take on variables]]></title>
      <guid>http://www.phpdeveloper.org/news/15049</guid>
      <link>http://www.phpdeveloper.org/news/15049</link>
      <description><![CDATA[<p>
<i>Derick Rethans</i> is republishing an article series he wrote (originally for <a href="http://phparch.com">php|architect</a>) about the garbage collection that is included with the PHP 5.3 releases. He kicks off the series with <a href="http://derickrethans.nl/collecting-garbage-phps-take-on-variables.html">this first post</a> introducing internal variable handling.
</p>
<blockquote>
Before we start with the intricate details of PHP's new GC engine I will explain why it is actually needed. This, combined with an introduction how PHP deals with variables in general is explained in this first part of the column. The second part will cover the solution and some notes on the GC mechanism itself, and the third part covers some implications of the GC mechanism, as well as some benchmarks. But now first on to the introduction.
</blockquote>
<p>
He introduces the concept of a "zval" - the container PHP uses internally to handle variables (along with its "is_ref" and "refcount" to tell the interpreter if it's a reference or not). He also shows how these relate to the variables you set in your applications as well as a mention of the <a href="http://www.xdebug.org/docs/all_functions#xdebug_debug_zval">xdebug_debug_zval</a> function of XDebug to show how it's handled behind the scenes. He also shows how references are handled with accompanying images to show the flow. If you'd like more information on variable handling, <i>Derick</i> points to <a href="http://derickrethans.nl/files/phparch-php-variables-article.pdf">this article</a> for more detail.
</p>]]></description>
      <pubDate>Tue, 31 Aug 2010 10:49:11 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Johannes Schluter's Blog: HashTables]]></title>
      <guid>http://www.phpdeveloper.org/news/15000</guid>
      <link>http://www.phpdeveloper.org/news/15000</link>
      <description><![CDATA[<p>
<i>Johannes Schluter</i> has <a href="http://schlueters.de/blog/archives/142-HashTables.html">a new post</a> to his blog on another PHP internals related topic - hashtables.
</p>
<blockquote>
While preparing my "<a href="http://phpconference.nl/schedule/talks#phphood">PHP Under The Hood</a>" talk for the Dutch PHP Conference there was a question on IRC about <a href="http://php.net/extension_loaded">extension_loaded</a>() being faster than <a href="http://php.net/function_exists">function_exists</a>(), which might be strange as both of them are simple hash lookups and a hash lookup is said to be O(1). I started to write some slides for it but figured out that I won't have the time to go through it during that presentation, so I'm doing this now.
</blockquote>
<p>
He talks about array storage (a "real" array), numeric and string-based keys, the internals of how each is stored and how the differences make the one function faster than the other (hint: it's all <a href="http://schlueters.de/~johannes/php/collisions.txt">about collisions</a>).
</p>]]></description>
      <pubDate>Mon, 23 Aug 2010 08:58:43 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Johannes Schluter's Blog: References and foreach]]></title>
      <guid>http://www.phpdeveloper.org/news/14999</guid>
      <link>http://www.phpdeveloper.org/news/14999</link>
      <description><![CDATA[<p>
To reinforce a point he's made before (references in PHP are bad) <i>Johannes Schluter</i> has <a href="http://schlueters.de/blog/archives/141-References-and-foreach.html">posted an example</a> to his blog of a specific instance that causes an (expected) issue with references and foreach loops.
</p>
<blockquote>
Now there is one use case which leads to an, at first, unexpected behavior which I didn't see as a real live issue when I stumbled over it at first, but then there were a few bug reports about it and recently a friend asked me about it ... so here it goes.
</blockquote>
<p>
He show a code snippet of looping over an array with two <a href="http://php.net/foreach">foreach</a>es and a <a href="http://php.net/print_r">print_r</a> that shows the bug - the array changed from the original for no clearly apparent reason. To understand why this happens, he goes into detail on how variables are handled - complete with graphs.
</p>]]></description>
      <pubDate>Fri, 20 Aug 2010 12:44:35 -0500</pubDate>
    </item>
  </channel>
</rss>

