fork download
  1. <?php
  2.  
  3. $array = array(
  4. array("0000000009999999","20181209","000000","REM BASICA","0.00","C"),
  5. array("0000000009999999","20181209","000000","CRED JUROS","0.02","C")
  6. );
  7.  
  8. function transforme($array)
  9. {
  10. $array_new = array();
  11. foreach($array as $values)
  12. {
  13. $array_copy = array();
  14. foreach ($values as $key => $value)
  15. {
  16. switch ($key) {
  17. case 0:
  18. $array_copy['Conta'] = $value;
  19. break;
  20. case 1:
  21. $array_copy['Data'] = $value;
  22. break;
  23. case 2:
  24. $array_copy['Cod'] = $value;
  25. break;
  26. case 3:
  27. $array_copy['Historico'] = $value;
  28. break;
  29. case 4:
  30. $array_copy['Valor'] = $value;
  31. break;
  32. case 5:
  33. $array_copy['Op'] = $value;
  34. break;
  35. }
  36. }
  37. $array_new[] = $array_copy;
  38. }
  39. return $array_new;
  40. }
  41.  
  42. print_r(transforme($array));
Success #stdin #stdout 0.01s 82560KB
stdin
Standard input is empty
stdout
Array
(
    [0] => Array
        (
            [Conta] => 0000000009999999
            [Data] => 20181209
            [Cod] => 000000
            [Historico] => REM BASICA
            [Valor] => 0.00
            [Op] => C
        )

    [1] => Array
        (
            [Conta] => 0000000009999999
            [Data] => 20181209
            [Cod] => 000000
            [Historico] => CRED JUROS
            [Valor] => 0.02
            [Op] => C
        )

)