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, -$testlen) === 0; } echo endswith('http://localhost/events/10','/events/');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OMtED
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'endswith'
          1        SEND_VAL                                                 'http%3A%2F%2Flocalhost%2Fevents%2F10'
          2        SEND_VAL                                                 '%2Fevents%2F'
          3        DO_FCALL                                      0  $0      
          4        ECHO                                                     $0
          5      > 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/OMtED
function name:  endswith
number of ops:  18
compiled vars:  !0 = $string, !1 = $test, !2 = $strlen, !3 = $testlen
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        STRLEN                                           ~4      !0
          3        ASSIGN                                                   !2, ~4
    6     4        STRLEN                                           ~6      !1
          5        ASSIGN                                                   !3, ~6
    7     6        IS_SMALLER                                               !2, !3
          7      > JMPZ                                                     ~8, ->9
          8    > > RETURN                                                   <false>
    8     9    >   INIT_FCALL                                               'substr_compare'
         10        SEND_VAR                                                 !0
         11        SEND_VAR                                                 !1
         12        MUL                                              ~9      !3, -1
         13        SEND_VAL                                                 ~9
         14        DO_ICALL                                         $10     
         15        IS_IDENTICAL                                     ~11     $10, 0
         16      > RETURN                                                   ~11
    9    17*     > RETURN                                                   null

End of function endswith

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.26 ms | 1398 KiB | 16 Q