3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = range('A', 'I'); $array2 = array(0 => 'A', 1 => 'B', 7 => 'H', 8 => 'I'); $size1 = count($array1); $size2 = count($array2); $hit = 0; $miss = -1; $min_size = min($size1, $size2); $array3 = array(); print_r($array2); for($i = 0; $i < $min_size ;$i++) { $flag = 0; if(isset($array1[$i]) && isset($array2[$i])) { if($array1[$i] === $array2[$i]) { $hit++; echo "hit\n"; $miss = -1; } else $flag = 1; } else { $flag = 1; } if($miss == -1) { if($hit > 0); array_push($array3, $hit); $miss = 0; array_push($array3, 0); } $hit = 0; } if($hit > 0) array_push($array3, $hit); if($size1 != $size2) { if($miss == -1) array_push($array3,0); //Suppose array sizes are not equal and last scanned element-pair is not matched. To avoid an additional 0 } print_r($array3);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 55
Branch analysis from position: 55
2 jumps found. (Code = 44) Position 1 = 57, Position 2 = 23
Branch analysis from position: 57
2 jumps found. (Code = 43) Position 1 = 59, Position 2 = 63
Branch analysis from position: 59
2 jumps found. (Code = 43) Position 1 = 65, Position 2 = 71
Branch analysis from position: 65
2 jumps found. (Code = 43) Position 1 = 67, Position 2 = 71
Branch analysis from position: 67
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 71
Branch analysis from position: 71
Branch analysis from position: 63
Branch analysis from position: 23
2 jumps found. (Code = 46) Position 1 = 26, Position 2 = 28
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 39
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 33, Position 2 = 37
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
2 jumps found. (Code = 43) Position 1 = 42, Position 2 = 53
Branch analysis from position: 42
2 jumps found. (Code = 43) Position 1 = 44, Position 2 = 44
Branch analysis from position: 44
2 jumps found. (Code = 44) Position 1 = 57, Position 2 = 23
Branch analysis from position: 57
Branch analysis from position: 23
Branch analysis from position: 44
Branch analysis from position: 53
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
Branch analysis from position: 39
2 jumps found. (Code = 43) Position 1 = 42, Position 2 = 53
Branch analysis from position: 42
Branch analysis from position: 53
Branch analysis from position: 28
filename:       /in/jNfUm
function name:  (null)
number of ops:  75
compiled vars:  !0 = $array1, !1 = $array2, !2 = $size1, !3 = $size2, !4 = $hit, !5 = $miss, !6 = $min_size, !7 = $array3, !8 = $i, !9 = $flag
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'range'
          1        SEND_VAL                                                 'A'
          2        SEND_VAL                                                 'I'
          3        DO_ICALL                                         $10     
          4        ASSIGN                                                   !0, $10
    4     5        ASSIGN                                                   !1, <array>
    6     6        COUNT                                            ~13     !0
          7        ASSIGN                                                   !2, ~13
    7     8        COUNT                                            ~15     !1
          9        ASSIGN                                                   !3, ~15
    8    10        ASSIGN                                                   !4, 0
    9    11        ASSIGN                                                   !5, -1
   10    12        INIT_FCALL                                               'min'
         13        SEND_VAR                                                 !2
         14        SEND_VAR                                                 !3
         15        DO_ICALL                                         $19     
         16        ASSIGN                                                   !6, $19
   11    17        ASSIGN                                                   !7, <array>
   12    18        INIT_FCALL                                               'print_r'
         19        SEND_VAR                                                 !1
         20        DO_ICALL                                                 
   13    21        ASSIGN                                                   !8, 0
         22      > JMP                                                      ->55
   15    23    >   ASSIGN                                                   !9, 0
   16    24        ISSET_ISEMPTY_DIM_OBJ                         0  ~25     !0, !8
         25      > JMPZ_EX                                          ~25     ~25, ->28
         26    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~26     !1, !8
         27        BOOL                                             ~25     ~26
         28    > > JMPZ                                                     ~25, ->39
   18    29    >   FETCH_DIM_R                                      ~27     !0, !8
         30        FETCH_DIM_R                                      ~28     !1, !8
         31        IS_IDENTICAL                                             ~27, ~28
         32      > JMPZ                                                     ~29, ->37
   20    33    >   PRE_INC                                                  !4
   21    34        ECHO                                                     'hit%0A'
   22    35        ASSIGN                                                   !5, -1
         36      > JMP                                                      ->38
   25    37    >   ASSIGN                                                   !9, 1
         38    > > JMP                                                      ->40
   29    39    >   ASSIGN                                                   !9, 1
   31    40    >   IS_EQUAL                                                 !5, -1
         41      > JMPZ                                                     ~34, ->53
   33    42    >   IS_SMALLER                                               0, !4
         43      > JMPZ                                                     ~35, ->44
   34    44    >   INIT_FCALL                                               'array_push'
         45        SEND_REF                                                 !7
         46        SEND_VAR                                                 !4
         47        DO_ICALL                                                 
   35    48        ASSIGN                                                   !5, 0
   36    49        INIT_FCALL                                               'array_push'
         50        SEND_REF                                                 !7
         51        SEND_VAL                                                 0
         52        DO_ICALL                                                 
   38    53    >   ASSIGN                                                   !4, 0
   13    54        PRE_INC                                                  !8
         55    >   IS_SMALLER                                               !8, !6
         56      > JMPNZ                                                    ~41, ->23
   40    57    >   IS_SMALLER                                               0, !4
         58      > JMPZ                                                     ~42, ->63
   41    59    >   INIT_FCALL                                               'array_push'
         60        SEND_REF                                                 !7
         61        SEND_VAR                                                 !4
         62        DO_ICALL                                                 
   42    63    >   IS_NOT_EQUAL                                             !2, !3
         64      > JMPZ                                                     ~44, ->71
   44    65    >   IS_EQUAL                                                 !5, -1
         66      > JMPZ                                                     ~45, ->71
   45    67    >   INIT_FCALL                                               'array_push'
         68        SEND_REF                                                 !7
         69        SEND_VAL                                                 0
         70        DO_ICALL                                                 
   48    71    >   INIT_FCALL                                               'print_r'
         72        SEND_VAR                                                 !7
         73        DO_ICALL                                                 
         74      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
183.97 ms | 1404 KiB | 21 Q