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_combine(array_slice($keys, 1), array_column(array_slice($arr,1), $key)); } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 29
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 29
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
filename:       /in/aPCub
function name:  (null)
number of ops:  34
compiled vars:  !0 = $arr, !1 = $keys, !2 = $val, !3 = $key, !4 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        INIT_FCALL                                               'array_keys'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $6      
          4        ASSIGN                                                   !1, $6
    6     5        FETCH_DIM_R                                      ~8      !1, 0
          6        FETCH_DIM_R                                      ~9      !0, ~8
          7      > FE_RESET_R                                       $10     ~9, ->29
          8    > > FE_FETCH_R                                       ~11     $10, !2, ->29
          9    >   ASSIGN                                                   !3, ~11
    7    10        INIT_FCALL                                               'array_combine'
         11        INIT_FCALL                                               'array_slice'
         12        SEND_VAR                                                 !1
         13        SEND_VAL                                                 1
         14        DO_ICALL                                         $14     
         15        SEND_VAR                                                 $14
         16        INIT_FCALL                                               'array_column'
         17        INIT_FCALL                                               'array_slice'
         18        SEND_VAR                                                 !0
         19        SEND_VAL                                                 1
         20        DO_ICALL                                         $15     
         21        SEND_VAR                                                 $15
         22        SEND_VAR                                                 !3
         23        DO_ICALL                                         $16     
         24        SEND_VAR                                                 $16
         25        DO_ICALL                                         $17     
         26        ASSIGN_DIM                                               !4, !2
         27        OP_DATA                                                  $17
    6    28      > JMP                                                      ->8
         29    >   FE_FREE                                                  $10
   10    30        INIT_FCALL                                               'var_export'
         31        SEND_VAR                                                 !4
         32        DO_ICALL                                                 
         33      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.45 ms | 1442 KiB | 18 Q