<?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 18:41:05 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Gonzalo Ayuso's Blog: How to use eval() without using eval() in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/17665</guid>
      <link>http://www.phpdeveloper.org/news/17665</link>
      <description><![CDATA[<p>
In <a href="http://gonzalo123.wordpress.com/2012/03/12/how-to-use-eval-without-using-eval-in-php/">this new post</a> <i>Gonzalo Ayuso</i> talks about "using eval without using eval" in PHP applications - executing PHP code without having to use the <a href="http://php.net/eval">eval</a> function to do it.
</p>
<blockquote>
Yes I know. Eval() is evil. If our answer is to use <a href="http://php.net/manual/en/function.eval.php">eval()</a> function, we are probably asking the wrong question. When we see an eval() function all our coding smell's red lights start flashing inside our mind. Definitely it's a bad practice. But last week I was thinking about it. How can I eval raw PHP code without using the eval function, and I will show you my outcomes.
</blockquote>
<p>
He includes some sample code showing a basic script with a class and a loop executing normally, then an "eval version" that puts it all in a string and executes it. He offers a different method - not an ideal one since it requires being able to write to the local file system, but prevents the need for eval - writing the PHP code to a temporary file and using a "fake eval" to <a href="htttp://php.net/include">pull it in</a>.
</p>]]></description>
      <pubDate>Tue, 13 Mar 2012 10:09:52 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Sameer Borate's Blog: Refactoring 3: Replace Temp with Query]]></title>
      <guid>http://www.phpdeveloper.org/news/12641</guid>
      <link>http://www.phpdeveloper.org/news/12641</link>
      <description><![CDATA[<p>
Continuing on in his refactoring series (<a href="http://www.phpdeveloper.org/news/11669">part 1</a> & <a href="http://www.phpdeveloper.org/news/11723">part 2</a>) <i>Sameer</i> has posted <a href="http://www.codediesel.com/refactoring/refactoring-3-replace-temp-with-query/">part three</a> - a method of replacing temporary variables with calls to other methods.
</p>
<blockquote>
Temporary variables are a integral part of any code. But a splattering of the same all over can make your code hard to understand or modify. Replace temp with query is a refactoring method where you replace temp variable expressions with methods. This method is often also required before you use the <a href="http://www.codediesel.com/refactoring/refactoring-2-extract-method/">Extract Method</a> refactoring.
</blockquote>
<p>
In his example, he takes a variable inside a current method (base_price) and replaces it with a method call by the same name resulting in a more reusable format other methods can call rather than just computing the value themselves.
</p>]]></description>
      <pubDate>Mon, 08 Jun 2009 11:18:47 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Mike Naberezny's Blog: PHP Temporary Streams]]></title>
      <guid>http://www.phpdeveloper.org/news/11243</guid>
      <link>http://www.phpdeveloper.org/news/11243</link>
      <description><![CDATA[<p>
Following up on <A href="http://www.sklar.com/blog/archives/116-Let-a-thousand-string-concatenations-bloom.html">this post</a> from <i>David Sklar</i>, <i>Mike Naberezny</i> has come up with a <a href="http://mikenaberezny.com/2008/10/17/php-temporary-streams/">few methods of his own</a> to come up with his "thousand string concatenations".
</p>
<blockquote>
It's been a while since David Sklar <a href="http://www.sklar.com/blog/archives/116-Let-a-thousand-string-concatenations-bloom.html">called out</a> to let a thousand string concatenations bloom. That discussion produced some entertaining suggestions for putting strings together such as using preg_replace and calling out to MySQL with SELECT CONCAT. 
</blockquote>
<p>
<i>Mike</i> goes with a bit different media of choice - the filesystem functions and streams. One example opens a file, writes to the file then rewinds back to the beginning of the stream. He modified this to make it slightly more useful (writing to memory not the file system) and shows how it could be used to make a temporary stream for testing purposes.
</p>]]></description>
      <pubDate>Mon, 20 Oct 2008 07:52:59 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Christopher Jones' Blog: Temporary LOBS in PHP's OCI8 Extension. Instant Client.]]></title>
      <guid>http://www.phpdeveloper.org/news/9460</guid>
      <link>http://www.phpdeveloper.org/news/9460</link>
      <description><![CDATA[<p>
<i>Christopher Jones</i> talks today on <a href="http://blogs.oracle.com/opal/2008/01/17#a264">his blog</a> about a bug he's just corrected and integrated into the release of the Oracle Instant Client that lets PHP correctly take advantage of the temporary LOBS functionality.
</p>
<blockquote>
When PHP is done with the temporary LOB, it needs to tell Oracle to destroy it. If this isn't done, then the temporary LOB will hang around using DB space until the connection is closed. I just merged a fix worked on by Krishna Mohan and myself for <a href="http://bugs.php.net/bug.php?id=43497">bug 43497</a>.
</blockquote>
<p>
Example code is included showing two instances of its use - a normal use that frees the memory correctly and the other showing how to create the temporary lob to hold the data as needed.
</p>]]></description>
      <pubDate>Mon, 21 Jan 2008 12:05:00 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Tim Koschuetzki's Blog: CakePHP 1.2 Manual]]></title>
      <guid>http://www.phpdeveloper.org/news/9035</guid>
      <link>http://www.phpdeveloper.org/news/9035</link>
      <description><![CDATA[<p>
As <i>Tim Koschuetzki</i> <a href="http://php-coding-practices.com/cakephp-specific/cakephp-12-manual/">points out</a>, a preliminary version of the manual for the upcoming CakePHP 1.2 release <a href="http://tempdocs.cakephp.org/">has been posted</a>:
</p>
<blockquote>
This version of the manual is very much a work in progress. It is being provided as a help, not an official reference, until CakePHP 1.2 reaches a final release state. While we feel this is a great start, please realize that the information provided here may be incorrect or incomplete.
</blockquote>
<p>
There's quite a bit <a href="http://tempdocs.cakephp.org/">there</a> already including documentation for new functionality like the config classes and URL extensions.
</p>]]></description>
      <pubDate>Wed, 14 Nov 2007 08:42:00 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Alex Netkachov's Blog: 6 PHP coding tips to write less code]]></title>
      <guid>http://www.phpdeveloper.org/news/8967</guid>
      <link>http://www.phpdeveloper.org/news/8967</link>
      <description><![CDATA[<p>
<i>Alex Netkachov</i> has <a href="http://www.alexatnet.com/node/100">shared six tips</a> in a new post on his blog today for how you can write less PHP code and get more done with it. It's based around <a href="http://www.phpdeveloper.org/news/8961">another post</a> from <i>Arnold Daniels</i> talking about a temporary variable method in PHP.
</p>
<blockquote>
This tip is useful to "lazy" developers who do not even think about variable names. They may prefer magic names like ${0} and 0 is good enough variable name, why not...
</blockquote>
<p>
His <a href="http://www.alexatnet.com/node/100">list</a> consists of:
</p>
<ul>
<li>Use || (or) and && (and) operations instead of if.
<li>Use ternary operator.
<li>Use for instead of while.
<li>In some cases PHP requires you to create a variable. [...] To handle all these situation you can create a set of small functions which shortcuts frequently used operations.
<li>Explore the language you use.
<li>When it is better to write more and then read the code easily, do not be lazy.
</ul>
<p>
Check out <a href="http://www.phpcult.com/blog/02/less-code-vs-good-code/">Vidyut Luther's response</a> to <i>Alex</i>'s comments as well as one from <a href="http://www.phpguru.org/#154">Richard Heyes</a>.
</p>]]></description>
      <pubDate>Mon, 05 Nov 2007 07:58:00 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Arnold Daniels' Blog: Perl like temporary variables in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/8961</guid>
      <link>http://www.phpdeveloper.org/news/8961</link>
      <description><![CDATA[<p>
<i>Arnold Daniels</i> <a href="http://blog.adaniels.nl/?p=58">points out</a> a quick method for creating what he calls "perl-like temporary variables" in the global scope of a script:
</p>
<blockquote>
When writing code in the global scope, I often have a problem where I'm overwriting a variable. This happens even more often when I work on code of somebody else. Usually has the variable which does the overwriting is usually just a temporary variable.
</blockquote>
<p>
<a href="http://blog.adaniels.nl/?p=58">His code</a> is a simple few lines that shows how it could be used when trying to write information out to a file handle. Some of the comments on the post criticize his use of the global scope but <i>Arnold</i> comes back with his reasoning - mostly that there is already code in the global scope and that adding something else is only adding to it, not making things worse.
</p>]]></description>
      <pubDate>Fri, 02 Nov 2007 09:38:00 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Webdigity.com: Caching your pages with PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/8261</guid>
      <link>http://www.phpdeveloper.org/news/8261</link>
      <description><![CDATA[<p>
On the Webdigity.com forums, there's <a href="http://www.webdigity.com/index.php?action=tutorial;code=5">this new tutorial</a> posted showing how to create a simple caching system with PHP for your site (using cached files).
</p>
<blockquote>
<p>
A problem that this process creates is the server overhead. Every time we execute a query in the database, the instance of our script will call the DBMS, and then the DBMS will send the results of the query. This is time consuming, and especially for sites with heavy traffic is a real big problem. 
</p>
<p>
There are two ways to solve this if you want to make your site faster. First is optimizing the queries Visit through proxy, but we will not talk about this at the present article. The second and most valuable is using some kind of custom caching technique.
</p>
</blockquote>
<p>
<a href="http://www.webdigity.com/index.php?action=tutorial;code=5">Their code</a>, contained in an easy-to-use class, makes it simple to cache the contents of a page just by setting the stop to start the caching from (and where to end).
</p>]]></description>
      <pubDate>Mon, 16 Jul 2007 18:55:00 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Tim Koschuetzki's Blog: Composing Methods: Remove Assignments to Parameters]]></title>
      <guid>http://www.phpdeveloper.org/news/8193</guid>
      <link>http://www.phpdeveloper.org/news/8193</link>
      <description><![CDATA[<p>
In another part of his "Composing Methods" series, <i>Tim Koschuetzki</i> <a href="http://php-coding-practices.com/refactoring/composing-methods/composing-methods-remove-assignments-to-parameters/">posts about</a> removing assignments to parameters today - working with a temporary variable inside a method rather than the actual passed in value.
</p>
<blockquote>
When your code assigns to a parameter in a function/method, use a temporary variable instead. [...] It will make your code much more readable and prevents by-reference confusion and therefore big problems in the future.
</blockquote>
<p>
His example code uses the illustration of calling a price() method in a class to modify the inputVal value based on other inputted information. His suggestion is to not work with the actual inputVal value passed in (so as to avoid issues if it happens to be passed my reference later), but to work with a temporary variable - $result - inside the method.
</p>]]></description>
      <pubDate>Fri, 06 Jul 2007 10:21:00 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHP-Coding-Practices.com: Composing Methods: Split Temporary Variable]]></title>
      <guid>http://www.phpdeveloper.org/news/8180</guid>
      <link>http://www.phpdeveloper.org/news/8180</link>
      <description><![CDATA[<p>
On the PHP-Coding-Practices.com blog, there's <a href="http://php-coding-practices.com/refactoring/composing-methods/composing-methods-split-temporary-variable/">a tutorial posted</a> from <i>Tim Koschuetzki</i> in his "Composing Methods" series looking at assigning temporary variables.
</p>
<blockquote>
When you have the same temporary variable assigned to more than once, split it up into two, unless it is a loop variable. [...] Temporary variables have various uses. They can be used as counters in loops, as collecting variables building up a result or as simple containers containing the result of a long-winded expression for easy reference.
</blockquote>
<p>
He <a href="http://php-coding-practices.com/refactoring/composing-methods/composing-methods-split-temporary-variable/">offers suggestions</a> of using temporary variables, including changing references of it after use and making a new temp variable following the second assignment of the first one. Some sample code is included to illustrate the points made.
</p>]]></description>
      <pubDate>Wed, 04 Jul 2007 11:26:00 -0500</pubDate>
    </item>
  </channel>
</rss>
