Too much of a PHP array?

Good afternoon, friends, pliz help with iterating through the array. PHP comes with JSON arrays whose data I want to write to CSV. Recording everything is OK, but can't figure out how can I iterate the array and write separately each line...

header('Content-Type: application/excel');
header('Content-Disposition: attachment; filename="price.csv"');

$resultArray = $_POST["resultArray"];

$list = array (
 array('View work', 'Ed.edit.', 'Price', 'Qty', "Just RUB"), // the cap table
 array(kind, ed, price, amount, totalPrice) / / and here I want to add the data from each 
//incoming array. 1 i.e. the array is one line in .csv
);

$fp = fopen('price.csv', 'w');
fputs($fp, chr(0xEF) . chr(0xBB) . chr(0xBF)); // BOM

foreach ($list as $fields) {
 fputcsv($fp, $fields);
}

fclose($fp);


An array which displays the var_dump
array(2) {
[110]=>
 array(5) {
["kind"]=>
 string(72) "Install ceiling dryer"
["ed"]=>
 string(4) "PCs"
["price"]=>
 string(4) "1500"
["amount"]=>
 string(1) "1"
["totalPrice"]=>
 string(5) "1 of 500"
}
[111]=>
 array(5) {
["kind"]=>
 string(66) "Install a wall-mounted clothes dryers"
["ed"]=>
 string(4) "PCs"
["price"]=>
 string(4) "1500"
["amount"]=>
 string(1) "1"
["totalPrice"]=>
 string(5) "1 of 500"
}
}


Pliz tell me how to do it.
P. S. the number of nested array (at the end of lines in .csv) can be different
March 19th 20 at 08:22
1 answer
March 19th 20 at 08:24
Solution
foreach ($list as $key=>$fields) {
 fputcsv($fp, $fields);
}

Find more questions by tags PHP