fork(2) download
  1. <?php
  2. $valores = [[
  3. 'vl_valor' => '123',
  4. 'vl_valorreal' => '123',
  5. 'referente' => '2018-11'
  6. ],
  7. [
  8. 'vl_valor' => '456',
  9. 'vl_valorreal' => '456',
  10. 'referente' => '2018-11'
  11. ]];
  12.  
  13. var_dump(reorganizaArray($valores));
  14.  
  15. function reorganizaArray($arr) {
  16. $arrOrganizado = [];
  17. for ($i = 0; $i < count($arr); $i++) {
  18. $temp = [];
  19. foreach ($arr[$i] as $key => $value) {
  20. $temp[$key] = $value;
  21. }
  22. $arrOrganizado[] = $temp;
  23. }
  24. return $arrOrganizado;
  25. }
Success #stdin #stdout 0s 82560KB
stdin
Standard input is empty
stdout
array(2) {
  [0]=>
  array(3) {
    ["vl_valor"]=>
    string(3) "123"
    ["vl_valorreal"]=>
    string(3) "123"
    ["referente"]=>
    string(7) "2018-11"
  }
  [1]=>
  array(3) {
    ["vl_valor"]=>
    string(3) "456"
    ["vl_valorreal"]=>
    string(3) "456"
    ["referente"]=>
    string(7) "2018-11"
  }
}