3v4l.org

run code in 300+ PHP versions simultaneously
<?php function decartProduct($one, $two) { $result = []; for($i=0; $i<count($one); $i++) { for($j=0; $j<count($two); $j++) { if(1) { $result[]=array_merge((array)$one[$i], (array)$two[$j]); } } } return $result; } function createAssotiation() { $args = func_get_args(); if(!count($args)) { return []; } $result = array_shift($args); while($array=array_shift($args)) { $result=decartProduct($result, $array); } return $result; } $i[0] = ['a', 'b', 'c']; $i[1] = ['d', 'e']; $i[2] = ['a', 'b', 'c']; $i[3] = ['d', 'e']; $i[4] = ['f', 'g', 'h']; $result = call_user_func_array('reateAssotiacion', $i); var_dump($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qkFkg
function name:  (null)
number of ops:  19
compiled vars:  !0 = $i, !1 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   ASSIGN_DIM                                               !0, 0
          1        OP_DATA                                                  <array>
   34     2        ASSIGN_DIM                                               !0, 1
          3        OP_DATA                                                  <array>
   35     4        ASSIGN_DIM                                               !0, 2
          5        OP_DATA                                                  <array>
   36     6        ASSIGN_DIM                                               !0, 3
          7        OP_DATA                                                  <array>
   37     8        ASSIGN_DIM                                               !0, 4
          9        OP_DATA                                                  <array>
   39    10        INIT_USER_CALL                                0          'call_user_func_array', 'reateAssotiacion'
         11        SEND_ARRAY                                               !0
         12        CHECK_UNDEF_ARGS                                         
         13        DO_FCALL                                      0  $7      
         14        ASSIGN                                                   !1, $7
   41    15        INIT_FCALL                                               'var_dump'
         16        SEND_VAR                                                 !1
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

Function decartproduct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 5
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 7
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 5
Branch analysis from position: 26
Branch analysis from position: 5
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 18
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 7
Branch analysis from position: 22
Branch analysis from position: 7
Branch analysis from position: 18
filename:       /in/qkFkg
function name:  decartProduct
number of ops:  28
compiled vars:  !0 = $one, !1 = $two, !2 = $result, !3 = $i, !4 = $j
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        ASSIGN                                                   !2, <array>
    5     3        ASSIGN                                                   !3, 0
          4      > JMP                                                      ->23
    7     5    >   ASSIGN                                                   !4, 0
          6      > JMP                                                      ->19
    9     7    > > JMPZ                                                     1, ->18
   11     8    >   INIT_FCALL                                               'array_merge'
          9        FETCH_DIM_R                                      ~9      !0, !3
         10        CAST                                          7  ~10     ~9
         11        SEND_VAL                                                 ~10
         12        FETCH_DIM_R                                      ~11     !1, !4
         13        CAST                                          7  ~12     ~11
         14        SEND_VAL                                                 ~12
         15        DO_ICALL                                         $13     
         16        ASSIGN_DIM                                               !2
         17        OP_DATA                                                  $13
    7    18    >   PRE_INC                                                  !4
         19    >   COUNT                                            ~15     !1
         20        IS_SMALLER                                               !4, ~15
         21      > JMPNZ                                                    ~16, ->7
    5    22    >   PRE_INC                                                  !3
         23    >   COUNT                                            ~18     !0
         24        IS_SMALLER                                               !3, ~18
         25      > JMPNZ                                                    ~19, ->5
   15    26    > > RETURN                                                   !2
   16    27*     > RETURN                                                   null

End of function decartproduct

Function createassotiation:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 6
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 11
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 11
Branch analysis from position: 21
Branch analysis from position: 11
filename:       /in/qkFkg
function name:  createAssotiation
number of ops:  23
compiled vars:  !0 = $args, !1 = $result, !2 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   FUNC_GET_ARGS                                    ~3      
          1        ASSIGN                                                   !0, ~3
   21     2        COUNT                                            ~5      !0
          3        BOOL_NOT                                         ~6      ~5
          4      > JMPZ                                                     ~6, ->6
   23     5    > > RETURN                                                   <array>
   25     6    >   INIT_FCALL                                               'array_shift'
          7        SEND_REF                                                 !0
          8        DO_ICALL                                         $7      
          9        ASSIGN                                                   !1, $7
   26    10      > JMP                                                      ->16
   28    11    >   INIT_FCALL                                               'decartproduct'
         12        SEND_VAR                                                 !1
         13        SEND_VAR                                                 !2
         14        DO_FCALL                                      0  $9      
         15        ASSIGN                                                   !1, $9
   26    16    >   INIT_FCALL                                               'array_shift'
         17        SEND_REF                                                 !0
         18        DO_ICALL                                         $11     
         19        ASSIGN                                           ~12     !2, $11
         20      > JMPNZ                                                    ~12, ->11
   30    21    > > RETURN                                                   !1
   31    22*     > RETURN                                                   null

End of function createassotiation

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.39 ms | 1407 KiB | 20 Q