title: When push objects to array in php, all objects are same
body: <p>I want to push many objects into a array</p>
  
  <p>and each object have different value</p>
  
  <p>but when I pushed them into array</p>
  
  <p>all values of them are same</p>
  
  <p>how to solve this problem?</p>
  
  <pre><code>$sql="select password, mail from account";
  $result=mysql_query($sql);
  $arr=array();
  while($row=mysql_fetch_assoc($result))
  {
      $o-&gt;pw=$row['password'];
      $o-&gt;mail=$row['mail'];
      array_push($arr, $o);
  }
  echo json_encode($arr);
  </code></pre>