3v4l.org

run code in 300+ PHP versions simultaneously
<?php function endsWith($haystack, $needle) { // search forward starting from end minus needle length characters return $needle === "" || (($temp = strlen($haystack) - strlen($needle)) >= 0 && strpos($haystack, $needle, $temp) !== FALSE); } $url = 'http://otmane.org/?mlb_t='; echo endsWith($url,'mlb_t=');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VrXA8
function name:  (null)
number of ops:  7
compiled vars:  !0 = $url
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   ASSIGN                                                   !0, 'http%3A%2F%2Fotmane.org%2F%3Fmlb_t%3D'
    7     1        INIT_FCALL                                               'endswith'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 'mlb_t%3D'
          4        DO_FCALL                                      0  $2      
          5        ECHO                                                     $2
          6      > RETURN                                                   1

Function endswith:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 4, Position 2 = 18
Branch analysis from position: 4
2 jumps found. (Code = 46) Position 1 = 10, Position 2 = 17
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
Branch analysis from position: 18
filename:       /in/VrXA8
function name:  endsWith
number of ops:  20
compiled vars:  !0 = $haystack, !1 = $needle, !2 = $temp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        IS_IDENTICAL                                     ~3      !1, ''
          3      > JMPNZ_EX                                         ~3      ~3, ->18
          4    >   STRLEN                                           ~4      !0
          5        STRLEN                                           ~5      !1
          6        SUB                                              ~6      ~4, ~5
          7        ASSIGN                                           ~7      !2, ~6
          8        IS_SMALLER_OR_EQUAL                              ~8      0, ~7
          9      > JMPZ_EX                                          ~8      ~8, ->17
         10    >   INIT_FCALL                                               'strpos'
         11        SEND_VAR                                                 !0
         12        SEND_VAR                                                 !1
         13        SEND_VAR                                                 !2
         14        DO_ICALL                                         $9      
         15        TYPE_CHECK                                  1018  ~10     $9
         16        BOOL                                             ~8      ~10
         17    >   BOOL                                             ~3      ~8
         18    > > RETURN                                                   ~3
    5    19*     > RETURN                                                   null

End of function endswith

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.22 ms | 1399 KiB | 16 Q