3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_between($input, $start, $end) { $substr = substr($input, strlen($start)+strpos($input, $start), (strlen($input) - strpos($input, $end))*(-1)); return $substr; } $the_string = "some string here string_1--------string2 some string here string_1--------string2 some string here string_1--------string2"; $a = "string_1"; $b = "string2"; echo get_between($the_string,$a,$b);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ccJke
function name:  (null)
number of ops:  10
compiled vars:  !0 = $the_string, !1 = $a, !2 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ASSIGN                                                   !0, 'some+string+here+string_1--------string2+some+string+here+string_1--------string2+some+string+here+string_1--------string2'
   15     1        ASSIGN                                                   !1, 'string_1'
   16     2        ASSIGN                                                   !2, 'string2'
   18     3        INIT_FCALL                                               'get_between'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !1
          6        SEND_VAR                                                 !2
          7        DO_FCALL                                      0  $6      
          8        ECHO                                                     $6
          9      > RETURN                                                   1

Function get_between:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ccJke
function name:  get_between
number of ops:  24
compiled vars:  !0 = $input, !1 = $start, !2 = $end, !3 = $substr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
    7     3        INIT_FCALL                                               'substr'
          4        SEND_VAR                                                 !0
          5        STRLEN                                           ~4      !1
          6        INIT_FCALL                                               'strpos'
          7        SEND_VAR                                                 !0
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                         $5      
         10        ADD                                              ~6      ~4, $5
         11        SEND_VAL                                                 ~6
         12        STRLEN                                           ~7      !0
         13        INIT_FCALL                                               'strpos'
         14        SEND_VAR                                                 !0
         15        SEND_VAR                                                 !2
         16        DO_ICALL                                         $8      
         17        SUB                                              ~9      ~7, $8
         18        MUL                                              ~10     ~9, -1
         19        SEND_VAL                                                 ~10
         20        DO_ICALL                                         $11     
         21        ASSIGN                                                   !3, $11
    8    22      > RETURN                                                   !3
    9    23*     > RETURN                                                   null

End of function get_between

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.05 ms | 1399 KiB | 18 Q