<?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>Wed, 23 May 2012 03:56:18 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Brandon Savage's Blog: Avoiding Notices: When to Use isset() and empty()]]></title>
      <guid>http://www.phpdeveloper.org/news/13270</guid>
      <link>http://www.phpdeveloper.org/news/13270</link>
      <description><![CDATA[<p>
If you've ever been bothered by those pesky NOTICEs when running your code, you know that you can wrap evaluations or check things with an <a href="http://php.net/empty">empty</a> or <a href="http://php.net/isset">isset</a> call to make them go away. <i>Brandon Savage</i> has <a href="http://www.brandonsavage.net/avoiding-notices-when-to-use-isset-and-empty/">a new post</a> that can help you decide which one to use when, though.
</p>
<blockquote>
As developers, we want to develop code that never emits notices or warnings, and PHP gets a bit antsy when we develop code that utilizes uninitialized variables. Lucky for us, PHP makes it easy to test for these variables without getting these notices. [...] PHP (like most languages) evaluates a logical argument left to right. For an AND condition, both conditions have to be true; PHP stops evaluating if it finds any condition untrue.
</blockquote>
<p>
He suggests that the case to use isset() is more when you just want to use another check in the conditional but don't want to be bothered if the variable isn't there. A call to empty(), however, also evaluates the contents of the variable if it exists. Be careful, though - empty() returns false if the value of the variable is false - so take care in your use and always test scripts with multiple values.
</p>]]></description>
      <pubDate>Wed, 23 Sep 2009 08:47:13 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Debuggable Blog: Supressing Errors in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/11848</guid>
      <link>http://www.phpdeveloper.org/news/11848</link>
      <description><![CDATA[<p>
<i>Felix Geisendorfer</i> has posted two new items to the Debuggable blog looking at suppressing errors in your applications - and no, that doesn't mean <a href="http://www.phpdeveloper.org/news/11672">using the @ operator</a> either.
</p>
<blockquote>
As of late I am getting sick of some best practices I have taught myself. Never using the @-error suppressing operator quickly moving to the top of the list. Before you start crying out loud (I know you will), let me say this: I do not mean to encourage anybody to use the @-operator. Applying the practice herein introduced may result in permanent damage to your coding habits and could serve as a gateway behavior to writing shitty code.
</blockquote>
<p>
He gives an example in the <a href="http://debuggable.com/posts/suppressing-php-errors-for-fun-and-profit">first post</a> of a place where he failed to properly check to ensure an element existed before checking a element of it. The <a href="http://debuggable.com/posts/suppressing-suppressing-php-errors-with-emptiness">second post</a> provides an interesting solution to the same problem - using <a href="http://php.net/empty">empty</a> on the element/subelement to check its existence.
</p>]]></description>
      <pubDate>Fri, 30 Jan 2009 11:14:58 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Brian Moon's Blog: Null vs. isset()]]></title>
      <guid>http://www.phpdeveloper.org/news/11837</guid>
      <link>http://www.phpdeveloper.org/news/11837</link>
      <description><![CDATA[<p>
In <a href="http://brian.moonspot.net/null-isset-php">this new post</a> to his blog, <i>Brian Moon</i> compares two things that, on the outside, might seem a lot alike but do have their differences under the hood - a null value and the <a href="http://php.net/isset">isset</a> function.
</p>
<blockquote>
I am working with a newcomer to PHP and he asked me about setting a variable to null and how to check that.  He had found some example or information that showed that setting a varaible equal to null would unset the variable. So, he was unclear if he could then reliably check if the variable was equal to null.  Having avoided null like the plague in my years of PHP, I was not sure. So, I mocked up a quick script to see what the states of a variable are in relation to null.
</blockquote>
<p>
His test verified that a variable, set equal to null will be found to be equal to null, will be set (<a href="http://php.net/isset">isset</a>) and will be found empty by PHP's <a href="http://php.net/empty">empty</a>
</p>]]></description>
      <pubDate>Thu, 29 Jan 2009 09:34:59 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Jani Hartikainen's Blog: Three PHP mistakes that will cause you debugging nightmares]]></title>
      <guid>http://www.phpdeveloper.org/news/11795</guid>
      <link>http://www.phpdeveloper.org/news/11795</link>
      <description><![CDATA[<p>
<i>Jani Hartikainen</i> has <a href="http://codeutopia.net/blog/2009/01/21/three-php-mistakes-that-will-cause-you-debugging-nightmares/">posted about</a> three simple, but hard to find, mistakes that can cause you endless frustration if you're not looking in the right places.
</p>
<p>Here's his list:</p>
<ul>
<li>Semicolon after a while - a small problem with big (infinitely looping) consequences)
<li>empty() and magic __get method - __get will hit first, then empty
<li>Missing semicolon after break or continue - a classic that can make switches and evaluations difficult to debug
</ul>
<p>
Comments on the post include a few others: working with variables by reference, comparisons with == versus === and strpos finding the first character in a string.
</p>]]></description>
      <pubDate>Thu, 22 Jan 2009 12:51:50 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[DevShed: Null and Empty Strings]]></title>
      <guid>http://www.phpdeveloper.org/news/11496</guid>
      <link>http://www.phpdeveloper.org/news/11496</link>
      <description><![CDATA[<p>
On DevShed today, there's a <a href="http://www.devshed.com/c/a/MySQL/Null-and-Empty-Strings/">new tutorial</a> posted looking at two things that can cause headaches for PHP developers (especially when evaluating and comparing values) - nulls and empty strings.
</p>
<blockquote>
Anyone who has programmed for any length of time has encountered the concepts of null and empty strings. They are not the same, and confusing the two can cause some serious problems. This article deals with these concepts in the context of PHP and MySQL.
</blockquote>
<p>
They start with a bit of a quiz before getting into how to handle them correctly - making null "safe" and working with it correctly in a MySQL context. SQL statements and table structures are included for their examples.
</p>]]></description>
      <pubDate>Wed, 03 Dec 2008 11:16:51 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Brian Moon's Blog: Stupid PHP Tricks: Normalizing SimpleXML Data]]></title>
      <guid>http://www.phpdeveloper.org/news/10328</guid>
      <link>http://www.phpdeveloper.org/news/10328</link>
      <description><![CDATA[<p>
<i>Brian Moon</i> has a "stupid PHP trick" posted to his blog today - <a href="http://brian.moonspot.net/2008/06/03/stupid-php-tricks-normalizing-simplexml-data/">normalizing SimpleXML data</a> you've pulled in from just about any external source.
</p>
<blockquote>
Anyhow, one annoying thing about SimpleXML has to do with caching.  When using web services, we often cache the contents we get back.  We were having a problem where we would get an error about a SimpleXML node not existing.
</blockquote>
<p>
They were using memcache to store the information but came across problems when their code tried to use a (sometimes) empty tag. He gives two solutions - one using a recursive function that identifies the empty items and the other that encodes then decodes the object to and from JSON, keeping the values intact.
</p>]]></description>
      <pubDate>Tue, 03 Jun 2008 09:34:22 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHP-GTK Community Site: Easily empty GtkContainer/GtkWindow]]></title>
      <guid>http://www.phpdeveloper.org/news/7407</guid>
      <link>http://www.phpdeveloper.org/news/7407</link>
      <description><![CDATA[<p>
The PHP-GTK Community site has <a href="http://www.php-gtk.eu/code-snippets/empty-container">a quick new post</a> today showing how to create/empty out a GtkContainer or GtkWindow in your code.
</p>
<blockquote>
This function provides an easy way to empty a GtkWindow/GtkContainer. I use it when i need to refresh a part of my app by replacing some widgets with others. It can destroy or preserve the child widgets depending on your needs.
</blockquote>
<p>
They <a href="http://www.php-gtk.eu/code-snippets/empty-container">provide both</a> the code itself and a sample usage - a three line script that shows three ways to use it - empty out a container, empty out the container but keep its children intact, and how to use it in the event of a button click.
</p>]]></description>
      <pubDate>Thu, 08 Mar 2007 08:42:00 -0600</pubDate>
    </item>
  </channel>
</rss>

