3v4l.org

run code in 300+ PHP versions simultaneously
<?php function IsEqual( $str,$str2 ) { $res = 0; for ($i=0, $max = count($str) -1; $i < $max; $i++) { if ( $str[$i] == $str2[$i]) { $res++; } else if ($str[$i] != $str2[$i]) { $res = 0; break; } } if (!$res) { return strlen($str) - strlen($str2); } else { return $res; } } $str = " 5"; $str2 = " 5"; $compRes = IsEqual($str,$str2); if (!$compRes){ echo "The \$str and \$str2 are the same.\n"; } else { echo "\$str is ",($compRes == 1)? "greater " : "less ", " than \$str2"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 11
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
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
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GE0Yu
function name:  (null)
number of ops:  20
compiled vars:  !0 = $str, !1 = $str2, !2 = $compRes
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   ASSIGN                                                   !0, '+++++5'
   27     1        ASSIGN                                                   !1, '++++++5'
   28     2        INIT_FCALL                                               'isequal'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_FCALL                                      0  $5      
          6        ASSIGN                                                   !2, $5
   29     7        BOOL_NOT                                         ~7      !2
          8      > JMPZ                                                     ~7, ->11
   30     9    >   ECHO                                                     'The+%24str+and+%24str2+are+the+same.%0A'
         10      > JMP                                                      ->19
   34    11    >   ECHO                                                     '%24str+is+'
         12        IS_EQUAL                                                 !2, 1
         13      > JMPZ                                                     ~8, ->16
         14    >   QM_ASSIGN                                        ~9      'greater+'
         15      > JMP                                                      ->17
         16    >   QM_ASSIGN                                        ~9      'less+'
         17    >   ECHO                                                     ~9
         18        ECHO                                                     '+than+%24str2'
   35    19    > > RETURN                                                   1

Function isequal:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 8
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 30
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 8
Branch analysis from position: 23
Branch analysis from position: 8
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 20
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
Branch analysis from position: 20
filename:       /in/GE0Yu
function name:  IsEqual
number of ops:  32
compiled vars:  !0 = $str, !1 = $str2, !2 = $res, !3 = $i, !4 = $max
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        ASSIGN                                                   !2, 0
    5     3        ASSIGN                                                   !3, 0
          4        COUNT                                            ~7      !0
          5        SUB                                              ~8      ~7, 1
          6        ASSIGN                                                   !4, ~8
          7      > JMP                                                      ->21
    6     8    >   FETCH_DIM_R                                      ~10     !0, !3
          9        FETCH_DIM_R                                      ~11     !1, !3
         10        IS_EQUAL                                                 ~10, ~11
         11      > JMPZ                                                     ~12, ->14
    7    12    >   PRE_INC                                                  !2
         13      > JMP                                                      ->20
    9    14    >   FETCH_DIM_R                                      ~14     !0, !3
         15        FETCH_DIM_R                                      ~15     !1, !3
         16        IS_NOT_EQUAL                                             ~14, ~15
         17      > JMPZ                                                     ~16, ->20
   11    18    >   ASSIGN                                                   !2, 0
   12    19      > JMP                                                      ->23
    5    20    >   PRE_INC                                                  !3
         21    >   IS_SMALLER                                               !3, !4
         22      > JMPNZ                                                    ~19, ->8
   16    23    >   BOOL_NOT                                         ~20     !2
         24      > JMPZ                                                     ~20, ->30
   17    25    >   STRLEN                                           ~21     !0
         26        STRLEN                                           ~22     !1
         27        SUB                                              ~23     ~21, ~22
         28      > RETURN                                                   ~23
         29*       JMP                                                      ->31
   21    30    > > RETURN                                                   !2
   25    31*     > RETURN                                                   null

End of function isequal

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.47 ms | 1403 KiB | 14 Q