3v4l.org

run code in 300+ PHP versions simultaneously
<?php function endswith($string, $test) { $strlen = strlen($string); $testlen = strlen($test); if ($testlen > $strlen) return false; return substr_compare($string, $test, $strlen - $testlen, $testlen) === 0; } if (version_compare(phpversion(), '5.1.0', '>')) { var_dump(endswith("abcdefg", "abc")); var_dump(endswith("abcdefg", "efg")); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 22
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/UsuJd
function name:  (null)
number of ops:  23
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_FCALL                                               'version_compare'
          1        INIT_FCALL                                               'phpversion'
          2        DO_ICALL                                         $0      
          3        SEND_VAR                                                 $0
          4        SEND_VAL                                                 '5.1.0'
          5        SEND_VAL                                                 '%3E'
          6        DO_ICALL                                         $1      
          7      > JMPZ                                                     $1, ->22
   11     8    >   INIT_FCALL                                               'var_dump'
          9        INIT_FCALL                                               'endswith'
         10        SEND_VAL                                                 'abcdefg'
         11        SEND_VAL                                                 'abc'
         12        DO_FCALL                                      0  $2      
         13        SEND_VAR                                                 $2
         14        DO_ICALL                                                 
   12    15        INIT_FCALL                                               'var_dump'
         16        INIT_FCALL                                               'endswith'
         17        SEND_VAL                                                 'abcdefg'
         18        SEND_VAL                                                 'efg'
         19        DO_FCALL                                      0  $4      
         20        SEND_VAR                                                 $4
         21        DO_ICALL                                                 
   13    22    > > RETURN                                                   1

Function endswith:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 9
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UsuJd
function name:  endswith
number of ops:  19
compiled vars:  !0 = $string, !1 = $test, !2 = $strlen, !3 = $testlen
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        STRLEN                                           ~4      !0
          3        ASSIGN                                                   !2, ~4
    5     4        STRLEN                                           ~6      !1
          5        ASSIGN                                                   !3, ~6
    6     6        IS_SMALLER                                               !2, !3
          7      > JMPZ                                                     ~8, ->9
          8    > > RETURN                                                   <false>
    7     9    >   INIT_FCALL                                               'substr_compare'
         10        SEND_VAR                                                 !0
         11        SEND_VAR                                                 !1
         12        SUB                                              ~9      !2, !3
         13        SEND_VAL                                                 ~9
         14        SEND_VAR                                                 !3
         15        DO_ICALL                                         $10     
         16        IS_IDENTICAL                                     ~11     $10, 0
         17      > RETURN                                                   ~11
    8    18*     > RETURN                                                   null

End of function endswith

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.18 ms | 1394 KiB | 23 Q