[Solved] Return all values from a PHP array for a given key


You can try making a 2d array so something like

$newarray = [
   "a" => ['red','pink','maroon'],
   "b" => ['green'],
   "c" => ['blue']
];

Then you can access the values like this:

$newarray['a']

Which will return an array containing red pink and maroon

1

solved Return all values from a PHP array for a given key