A
A
Andrey Angelovich Stock2018-04-05 15:21:54
PHP
Andrey Angelovich Stock, 2018-04-05 15:21:54

PHP how to remember which value belongs to which array?

Hey! There are arrays with data:

Array ( [0] => google [1] => 12512650 [2] => https://www.makfsa.ru/ [3] => https://ru.wikipsedia.org/wiki/%D0%9C%D0%B0%D0%BA%D1%84%D0%B0 [4] => http://makfa.nichosst.ru/ [5] => http://ru.makfapasta.com/production/product/pasta/ [6] => http://ru.makfapasta.com/ [7] => https://www.utkaonos.ru/item/42/1096519 [8] => https://www.utkonos.ru/item/42/1096522 [9] => https://www.utkonos.ru/item/1381/3223485 [10] => https://www.uatkonos.ru/item/42/1096527 [11] => https://proactions.ru/actions/food/makfa/ )

how can the array be rebuilt in such a way that all URLs are arrays and the first two values ​​of the array are added to them ( [0] => google [1] => 12512650 )? to get something like this:
Array ( [0]  => Array([0]  =>https://www.makfsa.ru/ [1] => google [2] => 12512650)
           [1]  => Array([0]  =>https://ru.wikipsedia.org/wiki/%D0%9C%D0%B0%D0%BA%D1%84%D0%B0 [1] => google [2] => 12512650)  ....

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladislav Soprun, 2018-04-05
@soprun

array_map to the rescue

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question