0

I'm reading an excel, and in the headers there are 2 equal values, for example "HELLO" and "HELLO", but when I create an array or object from those headers, using those values as key of each value, they are overwritten since They have the same value. How can I do to keep both records?

$dataE = Excel::selectSheetsByIndex(0)->load($archivo_procesar, function($reader) {
    $reader->each(function ($row){
        dump($row);
    });
    dd();
});

The excel that I'm reading is something like this:

----| GOD | GOD | HELLO | HELLO | PHP | LARAVEL | STACK | STACK

S1 |

S2 |

S3 |

S4 |

pmiranda
  • 7,602
  • 14
  • 72
  • 155
  • 2
    Whatever you like. Rename it, make it an array, etc... – miken32 Sep 21 '18 at 19:56
  • I need those values has the same name. I will edit the answer with a example of the file. – pmiranda Sep 21 '18 at 19:59
  • Use a different storage technique? Instead of `$array["HELLO"] = 1`, why not `$array[] = "HELLO"`? The former is employed commonly as a strategy to remove duplicates, which is what you don't want. – HoldOffHunger Sep 21 '18 at 20:10

0 Answers0