V
V
Vladislav2018-12-17 16:54:11
css
Vladislav, 2018-12-17 16:54:11

How to make a certain array from the values ​​obtained via fgetcsv()?

Hello everyone, there is a csv with the following data
5c17a7ae27b5f253657508.png
How can I sort them into the following array:

$arr = [
    '0.1' => [            // значение с правой колонки
         'old' => 0.1, // значение с правой колонки
         'new' => ['0.1'] // значение с левой колонки
    ],
    ...,
   '01.11.1' => [
        'old' => '01.11.1',
        'new' => [
              '01.11.1',
              '01.11.11',
               ....
                '01.11.2',
           ]
]
          // и т.д.

I succeeded in displaying the data, it is not clear how, under the condition of repeating the old key, the new values ​​\u200b\u200bare entered into the previous array.

Answer the question

In order to leave comments, you need to log in

6 answer(s)
V
Vitaly Inchin ☢, 2016-02-11
@floppyman

I am an artist with my mother.
ok, ok: https://jsfiddle.net/j9052yja/3/

A
Alexander Gamov, 2016-02-11
@slowdream

Move hands to the right place for such designers)
Either svg, or you need a solid color on the background.

W
Wheelie, 2016-02-11
@Wheelie

the first block has :after the picture on the right, the second has :before the picture on the left, the third :after has the picture on the right.
Text centered, image positioned absolute. It seems nothing complicated. A picture is a line from one text to another.

D
Dark Hole, 2016-02-11
@abyrkov

It seems to me alone that this is a normal border?! 1 element - top, left and bottom are visible, middle - top, right, bottom, bottom - similar to the top. If you put down the elements well, it is generally imperceptible that this is a border.

A
Alex, 2016-02-11
@astrodeep

Jeep)) In general, tear off the hands of the designer

S
Shirshov Alexander, 2018-12-18
@vos_50

$sorted = []; // Результирующий массив
        foreach ($lines as $line) { // $line[0] - old, $line[1] - new
            $sorted[$line[1]]['old'] = $line[1];
            $sorted[$line[1]]['new'][] = $line[0];
        }

If this is not it, then describe a specific set of input data (small) and what specific structure it should be converted to, we'll figure it out :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question