3v4l.org

run code in 300+ PHP versions simultaneously
<?php function flip($arr) { $result = array(); foreach ($arr as $index => $list) { foreach ($list as $key => $value) { $result[$key][$index] = $value; } } return $result; } $ar1 = array('Магазин 1', 15, 25, 30); $ar2 = array('Магазин 2', 25, 45, 50); $ar3 = array('Месяц', 1, 2, 3); $values = [$ar3, $ar1, $ar2]; var_dump(flip($values));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7Eopi
function name:  (null)
number of ops:  14
compiled vars:  !0 = $ar1, !1 = $ar2, !2 = $ar3, !3 = $values
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ASSIGN                                                   !0, <array>
   14     1        ASSIGN                                                   !1, <array>
   15     2        ASSIGN                                                   !2, <array>
   17     3        INIT_ARRAY                                       ~7      !2
          4        ADD_ARRAY_ELEMENT                                ~7      !0
          5        ADD_ARRAY_ELEMENT                                ~7      !1
          6        ASSIGN                                                   !3, ~7
   19     7        INIT_FCALL                                               'var_dump'
          8        INIT_FCALL                                               'flip'
          9        SEND_VAR                                                 !3
         10        DO_FCALL                                      0  $9      
         11        SEND_VAR                                                 $9
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Function flip:
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/7Eopi
function name:  flip
number of ops:  17
compiled vars:  !0 = $arr, !1 = $result, !2 = $list, !3 = $index, !4 = $value, !5 = $key
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
    7     8        FETCH_DIM_W                                      $13     !1, !5
          9        ASSIGN_DIM                                               $13, !3
         10        OP_DATA                                                  !4
    6    11      > JMP                                                      ->6
         12    >   FE_FREE                                                  $10
    5    13      > JMP                                                      ->3
         14    >   FE_FREE                                                  $7
   10    15      > RETURN                                                   !1
   11    16*     > RETURN                                                   null

End of function flip

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.16 ms | 1399 KiB | 16 Q