Problem adding property to stdClass php

0

I get the results in stdClass through a database query. Until this is fine, but I will have to add a new property in the result. Someone would know how to help me do this, I've been researching but I did not exist.

Like this:

array (
  0 => 
    object(stdClass)
      public 'aaaaaaa' => string '3'
      public 'aaaaaaaa' => string 'bbbbb'
  1 => 
    object(stdClass)
      public 'aaaaaaa' => string '4'
      public 'aaaaaaaa' => string 'ccccccc'

What I want:

array (
  0 => 
    object(stdClass)[66]
      public 'aaaaaaa' => string '3'
      public 'aaaaaaaa' => string 'bbbbb'
      public 'nova' => string 'yyyy'
  1 => 
    object(stdClass)[66]
      public 'aaaaaaa' => string '4'
      public 'aaaaaaaa' => string 'ccccccc'
      public 'nova' => string 'cccc'

I'm trying through the foreach:

foreach ($variavel as $key => $value) {

}
    
asked by anonymous 06.06.2018 / 04:22

0 answers