array 1 ($result1)
Array ( [0] => 286256 [1] => 286263 [2] => 286258 [3] => 286350 [4] => 286253 [5] => 286248 [6] => 286247 [7] => 286236 [8] => 286235 )
El segundo array tambien dinamico quiero que aparezca en la segunda columna
array 2 ($id)
Código PHP:
<?php
header("Content-Disposition: attachment; filename=\"cache\prestashop.xls");
header("Content-Type: application/vnd.ms-excel;");
header("Pragma: no-cache");
header("Expires: 0");
$out = fopen("php://output", 'w');
for ($id = 1; $id <= 10; $id++) {
$file= file_get_contents('cache/html.txt'); //archivo html dinamico cada ciclo
$regex = "|class=\"producto\"[^>]+>(.*?)<\/[^>]+>|";
preg_match_all($regex,$file,$result);
$result = $result[1];
$result1[] = $result;
}
foreach ($result1 as $data) //quiero recorrer los dos arrays
{
fputcsv($out, $data,"\t");
}
fclose($out);
?>
286256 286263 286258 286350 286253 286248 286247 286236 286235
Quiero que aparezca asi en excel
colum a colum b
array 1 array 2
286256 1
286263 1
286258 1
286350 1
286253 1
286248 1
286247 1
286236 1
286235 1
352685 5
458125 5
985632 5
475125 5
785125 5
954125 5
854123 5
854785 5
965235 5