3v4l.org

run code in 300+ PHP versions simultaneously
<?php function array_transpose(array $a) { $r = array(); foreach($a as $keyRow => $subArr) { foreach($subArr as $keyCol => $value) $r[$keyCol][$keyRow] = $value; } return $r; } $post = [ 'time_start'=> [ 0=> '00:00', 1=> '02:00' ], 'time_end' => [ 0 => '03:00', 1 => '05:00' ], 'time_teach' => [ 0 => '03:00', 1 => '00:00' ] ]; $newData = array_transpose($post); var_export($newData);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Seolg
function name:  (null)
number of ops:  9
compiled vars:  !0 = $post, !1 = $newData
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ASSIGN                                                   !0, <array>
   33     1        INIT_FCALL                                               'array_transpose'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $3      
          4        ASSIGN                                                   !1, $3
   35     5        INIT_FCALL                                               'var_export'
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Function array_transpose:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 14
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 14
Branch analysis from position: 4
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 12
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 12
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 12
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/Seolg
function name:  array_transpose
number of ops:  17
compiled vars:  !0 = $a, !1 = $r, !2 = $subArr, !3 = $keyRow, !4 = $value, !5 = $keyCol
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, <array>
    5     2      > FE_RESET_R                                       $7      !0, ->14
          3    > > FE_FETCH_R                                       ~8      $7, !2, ->14
          4    >   ASSIGN                                                   !3, ~8
    6     5      > FE_RESET_R                                       $10     !2, ->12
          6    > > FE_FETCH_R                                       ~11     $10, !4, ->12
          7    >   ASSIGN                                                   !5, ~11
          8        FETCH_DIM_W                                      $13     !1, !5
          9        ASSIGN_DIM                                               $13, !3
         10        OP_DATA                                                  !4
         11      > JMP                                                      ->6
         12    >   FE_FREE                                                  $10
    5    13      > JMP                                                      ->3
         14    >   FE_FREE                                                  $7
    8    15      > RETURN                                                   !1
    9    16*     > RETURN                                                   null

End of function array_transpose

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.48 ms | 1001 KiB | 15 Q