title: why the array index is undefined?
body: <p>I am using Yii, and I want to print an index of an array, but I get an error that the index is undefined, here is my code:</p>
  
  <pre><code> $criteria = new CDbCriteria;
   $criteria-&gt;select = 'username, password'; // select fields which you want in output
   $u = Users::model()-&gt;findAll($criteria);
  
   foreach($u as $u)
          $users["$u-&gt;username"] = "$u-&gt;password";
  
  echo $users['a'];
  </code></pre>
  
  <p>I printed the array and make sure that <code>a</code> index is exist, so what is the problem here?</p>