-3

I have this array :

[
  0 => [
    "Low" => "Few people"
  ]
  1 => [
    "Medium" => "Moderate"
  ]
  2 => [
    "High" => "Many people"
  ]
]

How can I make it like this:

[
  "Low" => "Few people",
  "Medium" => "Moderate",
  "High" => "Many people",
]

(remove all indexes of array)

I already tested array_values but it doesn't work.

Thanks for your help !

Romaixn
  • 80
  • 7
  • Well what exactly did you try? array_values doesn't transform anything, it merely gets a list of values. Show your actual attempt rather than just a vague description – ADyson May 05 '22 at 16:14
  • I just try `var_dump(array_values($array));` to see if it worked. For a full example I have an Enum and I do that : `array_map(fn (Influx $influx) => [$influx->name => $influx->value], Influx::cases())` to have a list of all my enum. – Romaixn May 05 '22 at 16:20
  • https://3v4l.org/cvQls – ADyson May 05 '22 at 16:23

0 Answers0