Undefined offset 0, but still gives me correct result
<pre><code>$options = array('health', 'strength', 'agility', 'stamina', 'defence');

$total = array();

foreach ($options as $value)
{
    foreach ($objects as $object)
    {
        $total[$value] += $object-&gt;$value;
    }
}

var_dump($total);
</code></pre>

<p>I have some objects in an array called <code>$objects</code>. It's giving the data to the <code>$total</code> as it should do.</p>

<p>But by some reason it's whining about some undefined offset.</p>

<pre><code> Notice: Undefined index: health in C:\wamp\www\objbattle\index.php on line 32
</code></pre>

<p>Line 32 is: <code>$total[$value] += $object-&gt;$value;</code></p>

<p>Why!? And how do I get rid of it?</p>
