Skip to content
Advertisement

How can i get sub array value to main array key? [Php]

I have an array. This array have a sub arrays. I want to take sub array value to main array keys. Here is my example array:

JavaScript

i want to take index-id to main array key my array must be like this

JavaScript

How can i do this?

Advertisement

Answer

Short solution using array_column and array_combine functions:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement