Sorry, cant find what i need. I have xls/xlsx. Then i get smth like this:
array
0 =>
array
0 => string 'NameFirstColumn'
1 => string 'NameSecondColumn'
1 =>
array
0 => string 'qqq'
1 => float 30
2 =>
array
0 => string 'www'
1 => float 20
First row is a header with names of values. How to make PHPExcel convert to array looks like:
array
0 =>
array
NameFirstColumn => string 'qqq'
NameSecondColumn => float 30
1 =>
array
NameFirstColumn => string 'www'
NameSecondColumn => float 20
Assuming that you already have this array in $array
$headings = array_shift($array);
array_walk(
$array,
function (&$row) use ($headings) {
$row = array_combine($headings, $row);
}
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With