Convert table to complex php array

This is generated via php (just an example. Maybe more of this.) How do I put this in just one array? So, I can pass it to view and output in the same format.

Name: abc       Address: xyz
Title   Paid
ABC     $100
CDE     $200

Name: rrt       Address: adf
Title   Paid
VDF     $140
CEE     $400

Name: xcv       Address: fdfs
Title   Paid
RET     $120
SSD     $430

      

+3


source to share


1 answer


$output = array(
    array(
        'name'=>'abc',
        'address'=>'xyz',
        'data'=>array(
            array(
                'title'=>ABC,
                'paid'=>100
            ),
            array(
                'title'=>CDE,
                'paid'=>200
            )
        )
    )
);

      



+2


source







All Articles