title: error while appending data into an array using array_push in php
body: <p>I want to filter my <code>data_array</code> and create a new array <code>$arr</code> with new data.I tried using following function.it is not appending data. but it is replacing the data.I know that I have to use <code>array_push()</code>. when I did that data is appending to the  array as <strong>single</strong> <strong>elements</strong>.</p>
  
  <pre><code> foreach ($data_array as $value) {
  
                  try {
                      $rep = $value-&gt;rep;
                      $idposition_rep = $value-&gt;idposition_rep;
                      $max_idinvoice = $value-&gt;max_idinvoice;
                      $idsession = $value-&gt;idsession;
                      $i_date = $value-&gt;i_date;
                      $last_i_time_string = $value-&gt;last_i_time;
                      $delayTime = $value-&gt;delayTime;
                      if ($delayTime &gt; 30) {
                          $arr[] = array(
                              'rep' =&gt; $rep,
                              'idposition_rep' =&gt; $idposition_rep,
                              'max_idinvoice' =&gt; $max_idinvoice,
                              'idsession' =&gt; $idsession,
                              'i_date' =&gt; $i_date,
                              'last_i_time_string' =&gt; $last_i_time_string,
                              'curr_time' =&gt; date("H:i:s"),
                              'delayTime' =&gt; $delayTime);
                      }
                  } catch (PDOException $ex) {
                      echo $ex-&gt;getMessage();
                      die;
                  }
              }
  </code></pre>