3v4l.org

run code in 500+ PHP versions simultaneously
<?php function hasMatchingBits($x, $y) { $x = strrev(decbin($x)); $y = strrev(decbin($y)); $lengthX = strlen($x); $lengthY = strlen($y); $length = $lengthX < $lengthY ? $lengthX : $lengthY; for ($i = 0; $i < $length; $i++) { if ($x[$i] === '1' && $y[$i] === '1') { return true; } } return false; } echo hasMatchingBits(196, 4) ? "Yes\n" : "No\n"; echo hasMatchingBits(196, 16) ? "Yes\n" : "No\n"; echo hasMatchingBits(4, 16) ? "Yes\n" : "No\n";
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
Branch analysis from position: 25
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
Branch analysis from position: 16
filename:       /in/8lSJX
function name:  (null)
number of ops:  28
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   21     0  E >   INIT_FCALL                                                   'hasmatchingbits'
          1        SEND_VAL                                                     196
          2        SEND_VAL                                                     4
          3        DO_FCALL                                          0  $0      
          4      > JMPZ                                                         $0, ->7
          5    >   QM_ASSIGN                                            ~1      'Yes%0A'
          6      > JMP                                                          ->8
          7    >   QM_ASSIGN                                            ~1      'No%0A'
          8    >   ECHO                                                         ~1
   22     9        INIT_FCALL                                                   'hasmatchingbits'
         10        SEND_VAL                                                     196
         11        SEND_VAL                                                     16
         12        DO_FCALL                                          0  $2      
         13      > JMPZ                                                         $2, ->16
         14    >   QM_ASSIGN                                            ~3      'Yes%0A'
         15      > JMP                                                          ->17
         16    >   QM_ASSIGN                                            ~3      'No%0A'
         17    >   ECHO                                                         ~3
   23    18        INIT_FCALL                                                   'hasmatchingbits'
         19        SEND_VAL                                                     4
         20        SEND_VAL                                                     16
         21        DO_FCALL                                          0  $4      
         22      > JMPZ                                                         $4, ->25
         23    >   QM_ASSIGN                                            ~5      'Yes%0A'
         24      > JMP                                                          ->26
         25    >   QM_ASSIGN                                            ~5      'No%0A'
         26    >   ECHO                                                         ~5
         27      > RETURN                                                       1

Function hasmatchingbits:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 24
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 28
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
2 jumps found. (Code = 46) Position 1 = 31, Position 2 = 34
Branch analysis from position: 31
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 36
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 36
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 28
Branch analysis from position: 39
Branch analysis from position: 28
Branch analysis from position: 34
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
filename:       /in/8lSJX
function name:  hasMatchingBits
number of ops:  41
compiled vars:  !0 = $x, !1 = $y, !2 = $lengthX, !3 = $lengthY, !4 = $length, !5 = $i
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
    6     2        INIT_FCALL                                                   'strrev'
          3        INIT_FCALL                                                   'decbin'
          4        SEND_VAR                                                     !0
          5        DO_ICALL                                             $6      
          6        SEND_VAR                                                     $6
          7        DO_ICALL                                             $7      
          8        ASSIGN                                                       !0, $7
    7     9        INIT_FCALL                                                   'strrev'
         10        INIT_FCALL                                                   'decbin'
         11        SEND_VAR                                                     !1
         12        DO_ICALL                                             $9      
         13        SEND_VAR                                                     $9
         14        DO_ICALL                                             $10     
         15        ASSIGN                                                       !1, $10
    8    16        STRLEN                                               ~12     !0
         17        ASSIGN                                                       !2, ~12
    9    18        STRLEN                                               ~14     !1
         19        ASSIGN                                                       !3, ~14
   10    20        IS_SMALLER                                                   !2, !3
         21      > JMPZ                                                         ~16, ->24
         22    >   QM_ASSIGN                                            ~17     !2
         23      > JMP                                                          ->25
         24    >   QM_ASSIGN                                            ~17     !3
         25    >   ASSIGN                                                       !4, ~17
   12    26        ASSIGN                                                       !5, 0
         27      > JMP                                                          ->37
   13    28    >   FETCH_DIM_R                                          ~20     !0, !5
         29        IS_IDENTICAL                                         ~21     ~20, '1'
         30      > JMPZ_EX                                              ~21     ~21, ->34
         31    >   FETCH_DIM_R                                          ~22     !1, !5
         32        IS_IDENTICAL                                         ~23     ~22, '1'
         33        BOOL                                                 ~21     ~23
         34    > > JMPZ                                                         ~21, ->36
   14    35    > > RETURN                                                       <true>
   12    36    >   PRE_INC                                                      !5
         37    >   IS_SMALLER                                                   !5, !4
         38      > JMPNZ                                                        ~25, ->28
   18    39    > > RETURN                                                       <false>
   19    40*     > RETURN                                                       null

End of function hasmatchingbits

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
160.16 ms | 2139 KiB | 18 Q