M
M
Murad_Geraev2021-12-07 15:37:32
PHP
Murad_Geraev, 2021-12-07 15:37:32

How to move data from one array to another?

There are arrays of data, I need some fields from them, for example name, value. How can I get them out of there and add them to a new array?
61af557519fbe987889936.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stalker_RED, 2021-12-07
@Stalker_RED

$myData = [];
foreach ($items as $key => $item) {
  $myData[$key] = [
    'name' => $item['name'],
    'value' => $item['value'],
  ];
};

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question