3v4l.org

run code in 300+ PHP versions simultaneously
<?php function compare($left, $right) { if (($length = mb_strlen($left)) != mb_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('Ð', 'Â')); var_dump(mb_strlen('Â')); var_dump(strlen('Ð')); var_dump(ord('Ð')); var_dump(ord('Â')); function test($char) { $length = strlen($char); for($i = 0; $i < $length; $i++) { var_dump(ord($char[$i])); } } var_dump(test('Ð'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2ooGZ
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                                                 '%C3%90'
          3        SEND_VAL                                                 '%C3%82'
          4        DO_FCALL                                      0  $0      
          5        SEND_VAR                                                 $0
          6        DO_ICALL                                                 
   15     7        INIT_FCALL                                               'var_dump'
          8        INIT_FCALL                                               'mb_strlen'
          9        SEND_VAL                                                 '%C3%82'
         10        DO_ICALL                                         $2      
         11        SEND_VAR                                                 $2
         12        DO_ICALL                                                 
   16    13        INIT_FCALL                                               'var_dump'
         14        SEND_VAL                                                 2
         15        DO_ICALL                                                 
   18    16        INIT_FCALL                                               'var_dump'
         17        SEND_VAL                                                 195
         18        DO_ICALL                                                 
   19    19        INIT_FCALL                                               'var_dump'
         20        SEND_VAL                                                 195
         21        DO_ICALL                                                 
   29    22        INIT_FCALL                                               'var_dump'
         23        INIT_FCALL                                               'test'
         24        SEND_VAL                                                 '%C3%90'
         25        DO_FCALL                                      0  $7      
         26        SEND_VAR                                                 $7
         27        DO_ICALL                                                 
         28      > RETURN                                                   1

Function compare:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 12
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 15
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 15
Branch analysis from position: 28
Branch analysis from position: 15
filename:       /in/2ooGZ
function name:  compare
number of ops:  31
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        INIT_FCALL                                               'mb_strlen'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $5      
          5        ASSIGN                                           ~6      !2, $5
          6        INIT_FCALL                                               'mb_strlen'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $7      
          9        IS_NOT_EQUAL                                             $7, ~6
         10      > JMPZ                                                     ~8, ->12
    5    11    > > RETURN                                                   <false>
    7    12    >   ASSIGN                                                   !3, 0
         13        ASSIGN                                                   !4, 0
         14      > JMP                                                      ->26
    8    15    >   INIT_FCALL                                               'ord'
         16        FETCH_DIM_R                                      ~11     !0, !3
         17        SEND_VAL                                                 ~11
         18        DO_ICALL                                         $12     
         19        INIT_FCALL                                               'ord'
         20        FETCH_DIM_R                                      ~13     !1, !3
         21        SEND_VAL                                                 ~13
         22        DO_ICALL                                         $14     
         23        BW_XOR                                           ~15     $12, $14
         24        ASSIGN_OP                                     9          !4, ~15
    7    25        PRE_INC                                                  !3
         26    >   IS_SMALLER                                               !3, !2
         27      > JMPNZ                                                    ~18, ->15
   10    28    >   IS_IDENTICAL                                     ~19     !4, 0
         29      > RETURN                                                   ~19
   11    30*     > RETURN                                                   null

End of function compare

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 5
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 5
Branch analysis from position: 15
Branch analysis from position: 5
filename:       /in/2ooGZ
function name:  test
number of ops:  16
compiled vars:  !0 = $char, !1 = $length, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
   22     1        STRLEN                                           ~3      !0
          2        ASSIGN                                                   !1, ~3
   24     3        ASSIGN                                                   !2, 0
          4      > JMP                                                      ->13
   25     5    >   INIT_FCALL                                               'var_dump'
          6        INIT_FCALL                                               'ord'
          7        FETCH_DIM_R                                      ~6      !0, !2
          8        SEND_VAL                                                 ~6
          9        DO_ICALL                                         $7      
         10        SEND_VAR                                                 $7
         11        DO_ICALL                                                 
   24    12        PRE_INC                                                  !2
         13    >   IS_SMALLER                                               !2, !1
         14      > JMPNZ                                                    ~10, ->5
   27    15    > > RETURN                                                   null

End of function test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.8 ms | 1410 KiB | 22 Q