title: How to push array in stdClass array in php
body: <p>I have an array which I am getting from my database. For instance:</p>
  
  <pre><code>$db_record = $this-&gt;search_model-&gt;search_Employee();
  foreach ($db_record as $db_data) {
      echo $db_data-&gt;phone_number;
  }
  </code></pre>
  
  <p>In above example I am able to fetch the record without any issue, but I want to add other data in <code>$db_data</code> afterwards.</p>
  
  <pre><code>foreach ($db_record as $db_data) {
      echo $db_data-&gt;phone_number;
      $db_data[]['new_value']='prashant';
  }
  </code></pre>
  
  <p>but <code>$db_data[]['new_value']='prashant';</code> throwing below error</p>
  
  <pre><code>Cannot use object of type stdClass as array in
  </code></pre>
  
  <p>It will great if someone can help me as struggeling more than 5 hours.</p>