title: codeigniter replace array values in model
body: <p>I have been going around in circles with a multidimensional array replace..</p>
  
  <p>I need to replace numbers stored in a DB that relate to a status type.. If I did this in the view it would work but it wont seem to replace in the model?</p>
  
  <pre><code>    function fetch_shipments($orgID){
      $this-&gt;db-&gt;select('shipID, shipRef, shipCarrier, shipOrigin, shipDestination, shipQty, shipStatus');
      $this-&gt;db-&gt;where('orgID', $orgID);
      $query = $this-&gt;db-&gt;get('shipments');
  
      $result = $query-&gt;result_array();
  
      foreach($result as $row) {
          foreach ($row as $key =&gt; $val) {
              $key == 'shipStatus' &amp;&amp; $val == 0 ? $val = 'Current' : $val;
              $key == 'shipStatus' &amp;&amp; $val == 1 ? $val = 'Pending' : $val;
              $key == 'shipStatus' &amp;&amp; $val == 2 ? $val = 'Complete' : $val;
          }
      }
  
      return $result;
  }
  </code></pre>
  
  <p>Has really left me scratching my head, I know this kind of foreach works as I use it all the time... I feel I am missing something (perhaps obvious) but I just cant put my finger on it. I even tried doing the replace at the object level before outputting an array but couldn't get that to work either.</p>