3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array ( 'EVENTNAME' => array ( 0 => 'Brexit', 1 => 'leave date set', 2 => 'leave date ', 3 => 'deal or no deal', ), 'IMMIGRATIONS' => array ( 0 => '1', 1 => '1', 2 => '1', 3 => '1', ), 'EFFECTS' => array ( 0 => '2', 1 => '1', 2 => '1', 3 => '2', ), 'SUPPLYCHAINS' => array ( 0 => '1', 1 => '1', 2 => '1', 3 => '1', ), ); $keys = array_keys($arr); foreach($arr[$keys[0]] as $key => $val){ $result[$val] = array_column(array_slice($arr,1), $key); } var_export($result);

preferences:
22.84 ms | 407 KiB | 5 Q