3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ 'name' => ['a', 'b', 'c'], 'age' => [ 2 , 1 , 3 , 4 ], 'shoe' => [11 , 9 ], 'kids' => [ 1 , 0 , 2 ] ]; $keys = array_keys($arr); $transposed = array_map(null, ...array_values($arr)); foreach ($transposed as &$subarray) { $subarray = array_combine($keys, $subarray); } var_export($transposed);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 15, Position 2 = 22
Branch analysis from position: 15
2 jumps found. (Code = 126) Position 1 = 16, Position 2 = 22
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/8BTuV
function name:  (null)
number of ops:  27
compiled vars:  !0 = $arr, !1 = $keys, !2 = $transposed, !3 = $subarray
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   10     1        INIT_FCALL                                               'array_keys'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $5      
          4        ASSIGN                                                   !1, $5
   11     5        INIT_FCALL                                               'array_map'
          6        SEND_VAL                                                 null
          7        INIT_FCALL                                               'array_values'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $7      
         10        SEND_UNPACK                                              $7
         11        CHECK_UNDEF_ARGS                                         
         12        DO_ICALL                                         $8      
         13        ASSIGN                                                   !2, $8
   12    14      > FE_RESET_RW                                      $10     !2, ->22
         15    > > FE_FETCH_RW                                              $10, !3, ->22
   13    16    >   INIT_FCALL                                               'array_combine'
         17        SEND_VAR                                                 !1
         18        SEND_VAR                                                 !3
         19        DO_ICALL                                         $11     
         20        ASSIGN                                                   !3, $11
   12    21      > JMP                                                      ->15
         22    >   FE_FREE                                                  $10
   15    23        INIT_FCALL                                               'var_export'
         24        SEND_VAR                                                 !2
         25        DO_ICALL                                                 
         26      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.25 ms | 1395 KiB | 23 Q