Notice: Undefined index: $key in C:\wamp\www
<p>when I define variable <code>$key</code>, then appears </p>

<blockquote>
  <p>Notice: Undefined index: $value in C:\wamp\www</p>
</blockquote>

<pre><code>&lt;?php
 $prices['Oil'] = 10;
 $prices['Spark Plugs'] = 4;
 $prices['Tires'] = 100;
 $prices['Fuses'] = 50;
while ($element = each($prices)){
echo $element['$key'];
echo " - ";
echo $element['$value'];
echo "&lt;br/&gt;";
}
 ?&gt;
  &lt;?php // -----------------------------
 foreach ($prices as $key =&gt; $value){
echo $key . ' =&gt; ' . $value . '&lt;br/&gt;';
}
  echo '&lt;br/&gt; &lt;br/&gt; &lt;br/&gt;';
   ?&gt; // THIS WORK FINE-----------------
</code></pre>
