-1

I have the following array:

Array (
  [ids] => Array ( 
    [0] => e348ae92
    [1] => 193ba701
    [2] => 58695854
  )
  [name] => Array (
    [0] => Customers
    [1] => Suppliers
    [2] => Users
  )
  [subs] => Array (
    [0] => 614 
    [1] => 65
    [2] => 99
  )
)

I want to take each array key and turn it into a it's own array e.g.

array(
  [0] = array(
    [0] => e348ae92
    [1] => custommers
    [2] => 614
  )
  [1] = array(
    [0] => 193ba701
    [1] => Suppliers
    [2] => 65
  )
  [2] = array (
    [0] => 58695854
    [1] => Users
    [2] => 99
  )
)

I have looked at array_merge, array_combine and a few other things but I have been unsuccessful so far, any pointers in the right direction would be appreciated.

GarethTF
  • 15
  • 4

1 Answers1

2

You can use array_map

 $f = array_map(null, $a['ids'], $a['name'], $a['subs']);
 print_r($f); 

Working example:https://3v4l.org/dDG0Y-

Rakesh Jakhar
  • 6,380
  • 2
  • 11
  • 20