3v4l.org

run code in 300+ PHP versions simultaneously
<?php function compare($left, $right) { if (($length = strlen($left)) != strlen($right)) { return false; } for ($i = 0, $result = 0; $i < $length; $i++) { $result |= ord($left[$i]) ^ ord($right[$i]); } return $result === 0; } var_dump(compare('A', 'A')); var_dump(comapre('A', 'a')); var_dump(compare('AAA', 'AAA')); var_dump(compare('µ', 'µ'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4O3mr
function name:  (null)
number of ops:  29
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'compare'
          2        SEND_VAL                                                 'A'
          3        SEND_VAL                                                 'A'
          4        DO_FCALL                                      0  $0      
          5        SEND_VAR                                                 $0
          6        DO_ICALL                                                 
   14     7        INIT_FCALL                                               'var_dump'
          8        INIT_FCALL_BY_NAME                                       'comapre'
          9        SEND_VAL_EX                                              'A'
         10        SEND_VAL_EX                                              'a'
         11        DO_FCALL                                      0  $2      
         12        SEND_VAR                                                 $2
         13        DO_ICALL                                                 
   15    14        INIT_FCALL                                               'var_dump'
         15        INIT_FCALL                                               'compare'
         16        SEND_VAL                                                 'AAA'
         17        SEND_VAL                                                 'AAA'
         18        DO_FCALL                                      0  $4      
         19        SEND_VAR                                                 $4
         20        DO_ICALL                                                 
   16    21        INIT_FCALL                                               'var_dump'
         22        INIT_FCALL                                               'compare'
         23        SEND_VAL                                                 '%C2%B5'
         24        SEND_VAL                                                 '%C2%B5'
         25        DO_FCALL                                      0  $6      
         26        SEND_VAR                                                 $6
         27        DO_ICALL                                                 
         28      > RETURN                                                   1

Function compare:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 11
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 11
Branch analysis from position: 24
Branch analysis from position: 11
filename:       /in/4O3mr
function name:  compare
number of ops:  27
compiled vars:  !0 = $left, !1 = $right, !2 = $length, !3 = $i, !4 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        STRLEN                                           ~5      !0
          3        ASSIGN                                           ~6      !2, ~5
          4        STRLEN                                           ~7      !1
          5        IS_NOT_EQUAL                                             ~6, ~7
          6      > JMPZ                                                     ~8, ->8
    5     7    > > RETURN                                                   <false>
    7     8    >   ASSIGN                                                   !3, 0
          9        ASSIGN                                                   !4, 0
         10      > JMP                                                      ->22
    8    11    >   INIT_FCALL                                               'ord'
         12        FETCH_DIM_R                                      ~11     !0, !3
         13        SEND_VAL                                                 ~11
         14        DO_ICALL                                         $12     
         15        INIT_FCALL                                               'ord'
         16        FETCH_DIM_R                                      ~13     !1, !3
         17        SEND_VAL                                                 ~13
         18        DO_ICALL                                         $14     
         19        BW_XOR                                           ~15     $12, $14
         20        ASSIGN_OP                                     9          !4, ~15
    7    21        PRE_INC                                                  !3
         22    >   IS_SMALLER                                               !3, !2
         23      > JMPNZ                                                    ~18, ->11
   10    24    >   IS_IDENTICAL                                     ~19     !4, 0
         25      > RETURN                                                   ~19
   11    26*     > RETURN                                                   null

End of function compare

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
197.04 ms | 1407 KiB | 20 Q