3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array1 = [1, 4, 7, 3, 3, 3]; $array2 = [4, 0, 3, 4, 9, 9]; function min_merge($arr1, $arr2) { $arr1 = array_count_values($arr1); $arr2 = array_count_values($arr2); foreach ($arr2 as $index=>$arr) if (!isset($arr1[$index]) || $arr > $arr1[$index]) $arr1[$index] = $arr; foreach ($arr1 as $index=>$arr) for ($i=0;$i<$arr;$i++) $final[] = $index; return $final; } print_r(min_merge($array1, $array2));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uBEsZ
function name:  (null)
number of ops:  10
compiled vars:  !0 = $array1, !1 = $array2
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
    4     1        ASSIGN                                                       !1, <array>
   21     2        INIT_FCALL                                                   'print_r'
          3        INIT_FCALL                                                   'min_merge'
          4        SEND_VAR                                                     !0
          5        SEND_VAR                                                     !1
          6        DO_FCALL                                          0  $4      
          7        SEND_VAR                                                     $4
          8        DO_ICALL                                                     
          9      > RETURN                                                       1

Function min_merge:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 23
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 23
Branch analysis from position: 12
2 jumps found. (Code = 47) Position 1 = 16, Position 2 = 19
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 22
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 22
Branch analysis from position: 19
Branch analysis from position: 23
2 jumps found. (Code = 77) Position 1 = 25, Position 2 = 35
Branch analysis from position: 25
2 jumps found. (Code = 78) Position 1 = 26, Position 2 = 35
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 29
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 29
Branch analysis from position: 34
Branch analysis from position: 29
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
Branch analysis from position: 23
filename:       /in/uBEsZ
function name:  min_merge
number of ops:  38
compiled vars:  !0 = $arr1, !1 = $arr2, !2 = $arr, !3 = $index, !4 = $i, !5 = $final
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    6     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
    7     2        INIT_FCALL                                                   'array_count_values'
          3        SEND_VAR                                                     !0
          4        DO_ICALL                                             $6      
          5        ASSIGN                                                       !0, $6
    8     6        INIT_FCALL                                                   'array_count_values'
          7        SEND_VAR                                                     !1
          8        DO_ICALL                                             $8      
          9        ASSIGN                                                       !1, $8
   10    10      > FE_RESET_R                                           $10     !1, ->23
         11    > > FE_FETCH_R                                           ~11     $10, !2, ->23
         12    >   ASSIGN                                                       !3, ~11
   11    13        ISSET_ISEMPTY_DIM_OBJ                             0  ~13     !0, !3
         14        BOOL_NOT                                             ~14     ~13
         15      > JMPNZ_EX                                             ~14     ~14, ->19
         16    >   FETCH_DIM_R                                          ~15     !0, !3
         17        IS_SMALLER                                           ~16     ~15, !2
         18        BOOL                                                 ~14     ~16
         19    > > JMPZ                                                         ~14, ->22
   12    20    >   ASSIGN_DIM                                                   !0, !3
         21        OP_DATA                                                      !2
   10    22    > > JMP                                                          ->11
         23    >   FE_FREE                                                      $10
   14    24      > FE_RESET_R                                           $18     !0, ->35
         25    > > FE_FETCH_R                                           ~19     $18, !2, ->35
         26    >   ASSIGN                                                       !3, ~19
   15    27        ASSIGN                                                       !4, 0
         28      > JMP                                                          ->32
   16    29    >   ASSIGN_DIM                                                   !5
         30        OP_DATA                                                      !3
   15    31        PRE_INC                                                      !4
         32    >   IS_SMALLER                                                   !4, !2
         33      > JMPNZ                                                        ~24, ->29
   14    34    > > JMP                                                          ->25
         35    >   FE_FREE                                                      $18
   18    36      > RETURN                                                       !5
   19    37*     > RETURN                                                       null

End of function min_merge

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
160.99 ms | 2700 KiB | 15 Q