fork download
  1. <?php
  2.  
  3. $data[] = array(
  4. 'data' => '2015-02-05',
  5. 'refer' => 'X741852',
  6. 'favorecido' => 'MARIA',
  7. 'debito' => '2.500'
  8. );
  9. $data[] = array(
  10. 'data' => '2015-02-05',
  11. 'refer' => 'B890656',
  12. 'favorecido' => 'EDUARDA',
  13. 'debito' => '500'
  14. );
  15. $data[] = array(
  16. 'data' => '2015-02-18',
  17. 'refer' => 'CK546045',
  18. 'favorecido' => 'JOAO',
  19. 'debito' => '42.050'
  20. );
  21. $data[] = array(
  22. 'data' => '2014-06-09',
  23. 'refer' => 'FE55852',
  24. 'favorecido' => 'CHARLES',
  25. 'debito' => '28.500'
  26. );
  27. $data[] = array(
  28. 'data' => '2014-06-09',
  29. 'refer' => 'X741852',
  30. 'favorecido' => 'VIVIANE',
  31. 'debito' => '74.2500'
  32. );
  33.  
  34. $i = 0;
  35.  
  36. foreach( $data as $item) $out[$item['data']][$i++] = $item;
  37.  
  38. print_r( $out );
  39.  
Success #stdin #stdout 0.04s 52480KB
stdin
Standard input is empty
stdout
Array
(
    [2015-02-05] => Array
        (
            [0] => Array
                (
                    [data] => 2015-02-05
                    [refer] => X741852
                    [favorecido] => MARIA
                    [debito] => 2.500
                )

            [1] => Array
                (
                    [data] => 2015-02-05
                    [refer] => B890656
                    [favorecido] => EDUARDA
                    [debito] => 500
                )

        )

    [2015-02-18] => Array
        (
            [2] => Array
                (
                    [data] => 2015-02-18
                    [refer] => CK546045
                    [favorecido] => JOAO
                    [debito] => 42.050
                )

        )

    [2014-06-09] => Array
        (
            [3] => Array
                (
                    [data] => 2014-06-09
                    [refer] => FE55852
                    [favorecido] => CHARLES
                    [debito] => 28.500
                )

            [4] => Array
                (
                    [data] => 2014-06-09
                    [refer] => X741852
                    [favorecido] => VIVIANE
                    [debito] => 74.2500
                )

        )

)