Warning: Array_Combine(): Both Parameters Should Have an Equal Number of Elements

Laravel 5.5 : array_combine(): Both parameters should have an equal number of elements

I assume the problem might be last row.

You can verify what's the exact problem replacing:

$row = array_combine($header, $row);

with:

if (count($header) != count($row)) {
dd($header, $row);
}

And in your case after tracking the problem you can simple skip the row in such case for example like this:

if (count($header) != count($row)) {
continue;
}

Find the error that array_combine(): Both parameters should have an equal number of elements

Please try using array_merge() instead. Hope this helps



Related Topics



Leave a reply



Submit