<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1040741" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1040741</link>
    <description></description>
    <language>en</language>
          <item>
    <title>good link :wall:
Note:</title>
    <link>https://www.webmaster-forums.net/webmasters-corner/it-just-me-php-empty-function#comment-1228897</link>
    <description> &lt;p&gt;good link :wall:&lt;/p&gt;
&lt;p&gt;Note: Simply doing if ($x) while $x is undefined will generate an error of level E_NOTICE. Instead, consider using empty() or isset() and/or initialize your variables. &lt;/p&gt;
&lt;p&gt;I have changed (and improved) some of my code thanks to the above. cheers.&lt;br /&gt;
You learn something new every day!&lt;/p&gt;
 </description>
     <pubDate>Sat, 01 Mar 2008 18:27:46 +0000</pubDate>
 <dc:creator>greg</dc:creator>
 <guid isPermaLink="false">comment 1228897 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>I just found a handy</title>
    <link>https://www.webmaster-forums.net/webmasters-corner/it-just-me-php-empty-function#comment-1228896</link>
    <description> &lt;p&gt;I just found a handy resource on type comparisons, thanks to StumbleUpon. &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/big.png&quot; title=&quot;Laughing out loud&quot; alt=&quot;Laughing out loud&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.php.net/manual/en/types.comparisons.php&quot; class=&quot;bb-url&quot;&gt;PHP type comparison tables&lt;/a&gt;&lt;/p&gt;
 </description>
     <pubDate>Sat, 01 Mar 2008 17:49:16 +0000</pubDate>
 <dc:creator>pr0gr4mm3r</dc:creator>
 <guid isPermaLink="false">comment 1228896 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>PHP made the change to call</title>
    <link>https://www.webmaster-forums.net/webmasters-corner/it-just-me-php-empty-function#comment-1228776</link>
    <description> &lt;p&gt;PHP made the change to call &quot;0&quot; empty in PHP4 - almost like an added feature. &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/confused.png&quot; title=&quot;Confused&quot; alt=&quot;Confused&quot; class=&quot;smiley-content&quot; /&gt; &lt;/p&gt;
&lt;p&gt;Function information: &lt;a href=&quot;http://us3.php.net/manual/en/function.empty.php&quot; title=&quot;http://us3.php.net/manual/en/function.empty.php&quot;&gt;http://us3.php.net/manual/en/function.empty.php&lt;/a&gt;&lt;/p&gt;
 </description>
     <pubDate>Mon, 25 Feb 2008 17:48:24 +0000</pubDate>
 <dc:creator>pr0gr4mm3r</dc:creator>
 <guid isPermaLink="false">comment 1228776 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>pr0gr4mm3r wrote:

Well,</title>
    <link>https://www.webmaster-forums.net/webmasters-corner/it-just-me-php-empty-function#comment-1228768</link>
    <description> &lt;blockquote class=&quot;bb-quote-body&quot;&gt;&lt;p&gt;&lt;strong&gt;pr0gr4mm3r wrote:&lt;/strong&gt; Well, technically, if your bank account is at 0, it would be empty, right?  Makes sense to me.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;I see your point, but you wouldn&#039;t use EMPTY to check if a value is other than zero. You use IF ==0 IF&amp;lt;&amp;gt;0 etc for that.&lt;/p&gt;
&lt;p&gt;So I disagree still with the way EMPTY is set up.&lt;br /&gt;
What about textual zero? It deems that to be empty too. Why? Just because a textual zero &quot;represents&quot; a numerical zero shouldn&#039;t make it assume empty.&lt;br /&gt;
That&#039;s just stupid IMHO&lt;/p&gt;
&lt;p&gt;The number zero is a numerical value, and for PHP to determine a variable set to numerical zero to be empty is not logical.&lt;br /&gt;
It&#039;s not empty, it is 0.&lt;br /&gt;
So using EMPTY for checking user input is no good, they might be allowed and correct in entering a numerical or textual zero.&lt;/p&gt;
&lt;p&gt;EMPTY should check if a var is empty, i.e. it contains no letters a-Z, numbers 0-9 and no other chars including space.&lt;br /&gt;
Then empty would determine correctly that a variable truly is EMPTY and could then be used to a much greater affect with the ISSET function.&lt;/p&gt;
&lt;p&gt;ISSET is fine and operates as it should.&lt;br /&gt;
If a variable is set to be anything it is set, even blank (not even whitespace) isset will return true.&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;&amp;lt;?php&lt;br /&gt;$var &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;; &lt;/span&gt;&lt;span style=&quot;color: #FF8000&quot;&gt;//no white space&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;isset(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$var&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color: #FF8000&quot;&gt;//returns true&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;br /&gt;
I agree with that, it has been set.&lt;/p&gt;
&lt;p&gt;The two then would be much more useful. If you want to check if a var is empty regardless of if it was ever set or used, then use EMPTY. If you want to check if a var has ever been used or set, then use ISSET.&lt;/p&gt;
&lt;p&gt;Currently you cannot use empty for checking results of calculations or user inputs because the input or calc might have returned zero.&lt;/p&gt;
&lt;p&gt;So my question is this, where can EMPTY be used with confidence?&lt;br /&gt;
You have to use it where you are checking for user input or form calculations where a single numerical or textual zero is not expected, to be more accurate - zero will never occur.&lt;br /&gt;
That makes potential problems.&lt;/p&gt;
&lt;p&gt;So even then with user input forms, telling them they did not fill in a field could be incorrect. They might have wanted their username to be a textual zero. And you should be telling them 0 is not a valid username, not they didnt type anything in.&lt;br /&gt;
And isset is not ueful for that because &#039;generally&#039; you have something like $name = $_POST[&#039;name&#039;];&lt;br /&gt;
even if the user never entered anything, isset will return true.&lt;/p&gt;
&lt;p&gt;I know all this is managable and there are ways and means, but IMHO, EMPTY could be much more useful if it returned false for a var with zero.&lt;/p&gt;
&lt;p&gt;I&#039;m off to email Rasmus Lerdorf &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/grin.png&quot; title=&quot;Laugh&quot; alt=&quot;Laugh&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
 </description>
     <pubDate>Mon, 25 Feb 2008 07:18:01 +0000</pubDate>
 <dc:creator>greg</dc:creator>
 <guid isPermaLink="false">comment 1228768 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>Well, technically, if your</title>
    <link>https://www.webmaster-forums.net/webmasters-corner/it-just-me-php-empty-function#comment-1228754</link>
    <description> &lt;p&gt;Well, technically, if your bank account is at 0, it would be empty, right?  Makes sense to me.&lt;/p&gt;
 </description>
     <pubDate>Sun, 24 Feb 2008 20:35:56 +0000</pubDate>
 <dc:creator>pr0gr4mm3r</dc:creator>
 <guid isPermaLink="false">comment 1228754 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>Yeah, I found out about that</title>
    <link>https://www.webmaster-forums.net/webmasters-corner/it-just-me-php-empty-function#comment-1228750</link>
    <description> &lt;p&gt;Yeah, I found out about that one the hard way. I don&#039;t like that behavior either. I use &lt;a href=&quot;http://us.php.net/manual/en/function.isset.php&quot;&gt;isset()&lt;/a&gt; a lot more because of it.&lt;/p&gt;
 </description>
     <pubDate>Sun, 24 Feb 2008 16:26:37 +0000</pubDate>
 <dc:creator>teammatt3</dc:creator>
 <guid isPermaLink="false">comment 1228750 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
