Good day. Please help me find the right direction for the implementation of my task, which is as follows:

There are 2 lists. The first is an excel spreadsheet, the second is a txt file. In the first list there are several parameters: city, index, name. In the second list, only the city. The city parameter in the first and second lists is written differently: in the first, each city is listed in its cell in the excel file (index and name, respectively, too, each in its cell), in the second, all cities are comma-separated with a different register .

What is required: compare the first (excel-file) and second (txt-file) lists, find duplicate cities in them and deduce from the first list only those lines in the excel-file (that is, city, index, full name) that will match without register with the second list.

Thanks in advance for the tips!

  • Give examples of the data of the first and second file. - fens
  • if you really excel then at least you need PHPExcel lib. Next, explode the textbook by ',' and bring the second and first list to the same register through strtolower and then the actual comparison. Attention if you can have cities with Cyrillic names, then instead of strtolower you should use mb_strtolower - fens
  • Also, for comparison, after casting both to one register, you can use the array_intersect function by passing the array with the values ​​from the first list as the first parameter, and as a result of the second array with the values ​​from the second, you get a list from the first array whose elements are found in the second. - fens

0