3v4l.org

run code in 300+ PHP versions simultaneously
<?php function endswith($haystack, $needle) { $length = strlen($needle); if ($length == 0) { return true; } return (substr($haystack, -$length) === $needle); } if (version_compare(phpversion(), '5.1.0', '>')) { var_dump(endswith("abcdefg", "abc")); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 15
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/55ajg
function name:  (null)
number of ops:  16
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     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, ->15
   13     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                                                 
   14    15    > > RETURN                                                   1

Function endswith:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/55ajg
function name:  endswith
number of ops:  15
compiled vars:  !0 = $haystack, !1 = $needle, !2 = $length
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        STRLEN                                           ~3      !1
          3        ASSIGN                                                   !2, ~3
    5     4        IS_EQUAL                                                 !2, 0
          5      > JMPZ                                                     ~5, ->7
    6     6    > > RETURN                                                   <true>
    9     7    >   INIT_FCALL                                               'substr'
          8        SEND_VAR                                                 !0
          9        MUL                                              ~6      !2, -1
         10        SEND_VAL                                                 ~6
         11        DO_ICALL                                         $7      
         12        IS_IDENTICAL                                     ~8      !1, $7
         13      > RETURN                                                   ~8
   10    14*     > RETURN                                                   null

End of function endswith

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.5 ms | 1390 KiB | 22 Q