<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1041800" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1041800</link>
    <description></description>
    <language>en</language>
          <item>
    <title>I agree, just use it because</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/unsure-php-practice#comment-1232866</link>
    <description> &lt;p&gt;I agree, just use it because most of the time it works is bad practice. &lt;/p&gt;
&lt;p&gt;You need to know the difference, and use it accordingly to the circumstance. I don&#039;t think their is a definite place to draw the line, it is up the programmer to have to ability to determine that when coding.&lt;/p&gt;
&lt;p&gt;For example, If I have a div on a page to contain someones phone number if there was a phone number entered in a form, and I don&#039;t want the div to show if there wasn&#039;t one, I&#039;m not going to check every possible thing about the variable. &lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;$strPhoneNum = preg_replace(&amp;quot;/[^0-9]/&amp;quot;,&amp;quot;&amp;quot;,$_POST[&amp;quot;txtPhoneNum&amp;quot;]);&lt;br /&gt;&lt;br /&gt;if ($strPhoneNum != &amp;#039;&amp;#039;) {&lt;br /&gt;&amp;nbsp; echo &amp;quot;&amp;lt;div id=&amp;#039;PhoneNum&amp;#039;&amp;gt;&amp;quot; . format_phone($strPhoneNum,&amp;#039;US&amp;#039;) . &amp;quot;&amp;lt;/div&amp;gt;\n&amp;quot;;&lt;br /&gt;}&lt;/code&gt;&lt;/div&gt;&lt;br /&gt;
(Note, I&#039;ve tried editing this to display right, it still seems to be wrapping lines and changing fonts in the middle???)&lt;/p&gt;
&lt;p&gt;In this case, i only care if there is at least a char. yes I could have use if(strlen($strPhoneNum)&amp;gt;0) but I prefer to not use a function if not needed.&lt;/p&gt;
&lt;p&gt;-Greg&lt;/p&gt;
 </description>
     <pubDate>Sat, 30 Aug 2008 16:50:00 +0000</pubDate>
 <dc:creator>Greg K</dc:creator>
 <guid isPermaLink="false">comment 1232866 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>Greg K wrote:
Usually for</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/unsure-php-practice#comment-1232863</link>
    <description> &lt;p&gt;&lt;div class=&quot;quote-msg&quot;&gt;&lt;div class=&quot;quote-author&quot;&gt;&lt;em&gt;Greg K&lt;/em&gt; wrote:&lt;/div&gt;Usually for most programming though, treating &quot;&quot; and NULL the same works well, but there are times where a difference is noticed and/or needed.&lt;/p&gt;
&lt;p&gt;-Greg&lt;/div&gt;&lt;br /&gt;
Yes, and the difference is because, well, there is a difference. Where would you draw the line to differences and specific definitions of something?&lt;/p&gt;
&lt;p&gt;&quot;Well, I only need a &lt;strong&gt;rough estimate&lt;/strong&gt;, and as I&#039;m working with numbers in the millions 1 is the same as 2 in my circumstance.&quot;&lt;br /&gt;
Using &quot;one or the other&quot; because &quot;most&quot; circumstances allow it without a problem is bad coding imo. The differences should be understood and the correct one used in the correct circumstances.&lt;/p&gt;
 </description>
     <pubDate>Sat, 30 Aug 2008 14:51:28 +0000</pubDate>
 <dc:creator>greg</dc:creator>
 <guid isPermaLink="false">comment 1232863 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>$arc_cats = (array) null;</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/unsure-php-practice#comment-1232853</link>
    <description> &lt;p&gt;$arc_cats = (array) null; try it.&lt;/p&gt;
 </description>
     <pubDate>Sat, 30 Aug 2008 10:30:46 +0000</pubDate>
 <dc:creator>John_audson</dc:creator>
 <guid isPermaLink="false">comment 1232853 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>Yes, but there are times</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/unsure-php-practice#comment-1232852</link>
    <description> &lt;p&gt;Yes, but there are times when you do have a difference between a null value and an &quot;empty&quot; value&lt;/p&gt;
&lt;p&gt;code at work had to figure out a &quot;glitch&quot;, there was an enum field in sql,  either an empty string or &quot;checked&quot;&lt;/p&gt;
&lt;p&gt;well the items that were imported in when it began, didn&#039;t have that field, so they were all NULL. In SQL $field&amp;lt;&amp;gt;&quot;checked&quot; is NOT true if the field is actually NULL. took me a little bit to track that one down (edited the table to set the default value to be empty sting)&lt;/p&gt;
&lt;p&gt;Also anohter issue brought up.. isset($arrayName[&#039;key&#039;]  and  array_key_exists(&#039;key&#039;,$arrayName) will return different values if $arrayName[&#039;key&#039;] is NULL (the isset will return FALSE)&lt;/p&gt;
&lt;p&gt;Usually for most programming though, treating &quot;&quot; and NULL the same works well, but there are times where a difference is noticed and/or needed.&lt;/p&gt;
&lt;p&gt;-Greg&lt;/p&gt;
 </description>
     <pubDate>Sat, 30 Aug 2008 03:08:45 +0000</pubDate>
 <dc:creator>Greg K</dc:creator>
 <guid isPermaLink="false">comment 1232852 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>That&#039;s what I thought, which</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/unsure-php-practice#comment-1232846</link>
    <description> &lt;p&gt;That&#039;s what I thought, which is why I don&#039;t understand why it&#039;s being used this way.&lt;/p&gt;
 </description>
     <pubDate>Fri, 29 Aug 2008 22:02:18 +0000</pubDate>
 <dc:creator>pr0gr4mm3r</dc:creator>
 <guid isPermaLink="false">comment 1232846 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>Greg K is absolutely</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/unsure-php-practice#comment-1232844</link>
    <description> &lt;p&gt;Greg K is absolutely correct: &lt;code&gt;$src_cats = (array) somevalue;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://us.php.net/language.types.type-juggling&quot; title=&quot;http://us.php.net/language.types.type-juggling&quot;&gt;http://us.php.net/language.types.type-juggling&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;anyway, doesn&#039;t&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;$src_cats = array();&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;create an empty array?&lt;/p&gt;
&lt;p&gt;and&lt;/p&gt;
&lt;p&gt;&lt;code&gt;$subcategories_content = &amp;quot;&amp;quot;;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;creates an empty string?&lt;/p&gt;
 </description>
     <pubDate>Fri, 29 Aug 2008 21:19:16 +0000</pubDate>
 <dc:creator>decibel.places</dc:creator>
 <guid isPermaLink="false">comment 1232844 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>I could understand using</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/unsure-php-practice#comment-1232840</link>
    <description> &lt;p&gt;I could understand using type casting to make it so if you check the variable type, even though it is null, it would pass as an array, however I would think it would be this:&lt;/p&gt;
&lt;p&gt;$arc_cats = (array) null;&lt;/p&gt;
&lt;p&gt;Either was, I don&#039;t think I would use it that way, a little to confusing.&lt;/p&gt;
&lt;p&gt;-Greg&lt;/p&gt;
 </description>
     <pubDate>Fri, 29 Aug 2008 18:55:34 +0000</pubDate>
 <dc:creator>Greg K</dc:creator>
 <guid isPermaLink="false">comment 1232840 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
