php - Creating a multi dimensional array - is there a better way than this -


i have code

        foreach ($objworksheet->getrowiterator() $row) {              $output[] = array();              //adding blank array end doesn't seem              //advance array pointer manually.             $test = end($output);               $celliterator = $row->getcelliterator();             foreach ($celliterator $cell) {                 //specifically bit                 $output[key($output)][] = $cell->getvalue();             }         } 

but don't how i've found current key using

$output[key($output)][] = $cell->getvalue(); 

is there better approach?

why don't use variable?

foreach ($objworksheet->getrowiterator() $row) {     $cells = array();     foreach ($row->getcelliterator() $cell) {         $cells[] = $cell->getvalue();     }     $output[] = $cells; } 

Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -