Setting initial values for objects
<p>Because I'm a programmer who likes clear, concise and less error-prone code, I always assign my variables a default value before they are used; I'm sure we all know why this is a good idea.</p>

<p>The one case that I find extremely annoying however, is when it comes to pre-setting variables that are meant to hold objects.  I haven't found a suitable initial value worth setting.</p>

<p>I find it important to point out that I'm also not a fan of relying on PHP's loosely typed features.  I do not like changing the type of a variable during it's lifespan, as I find it to be a messy, error prone guessing game.  In the past, I have set my object variables initial value to NULL, but this isn't really an appropriate value in PHP as this removes the variable from the identifier table and allows it to be collected by GC; odds are it wont be collected before it's used, but it still seems dirty.</p>

<p>That said, what do you guys set your initial values to be when your variable holds an object?</p>

<pre><code>$foo_id  = 0;
$is_foo  = false;
$foo     = '';
$obj_foo = NULL; // not really an appropriate initial value
</code></pre>

<p><strong>Edit</strong></p>

<p>For clarification as to why I think the default value should not be set to null, take the following:</p>

<pre><code>$obj_foo = null;
echo isset($obj_foo); // false
</code></pre>

<p>Often, this wouldn't cause a problem, but I could see it doing so for that painful 1%.</p>
