3v4l.org

run code in 300+ PHP versions simultaneously
<?php function GetBetween($content,$start,$end){ $r = explode($start, $content); if (isset($r[1])){ $r = explode($end, $r[1]); return $r[0]; } return ''; } echo GetBetween('foo test bar', 'foo', 'bar'); print_r(explode("help","help php program")); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SM7Ld
function name:  (null)
number of ops:  14
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                               'getbetween'
          1        SEND_VAL                                                 'foo+test+bar'
          2        SEND_VAL                                                 'foo'
          3        SEND_VAL                                                 'bar'
          4        DO_FCALL                                      0  $0      
          5        ECHO                                                     $0
   12     6        INIT_FCALL                                               'print_r'
          7        INIT_FCALL                                               'explode'
          8        SEND_VAL                                                 'help'
          9        SEND_VAL                                                 'help+php+program'
         10        DO_ICALL                                         $1      
         11        SEND_VAR                                                 $1
         12        DO_ICALL                                                 
   14    13      > RETURN                                                   1

Function getbetween:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 18
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SM7Ld
function name:  GetBetween
number of ops:  20
compiled vars:  !0 = $content, !1 = $start, !2 = $end, !3 = $r
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
    3     3        INIT_FCALL                                               'explode'
          4        SEND_VAR                                                 !1
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $4      
          7        ASSIGN                                                   !3, $4
    4     8        ISSET_ISEMPTY_DIM_OBJ                         0          !3, 1
          9      > JMPZ                                                     ~6, ->18
    5    10    >   INIT_FCALL                                               'explode'
         11        SEND_VAR                                                 !2
         12        FETCH_DIM_R                                      ~7      !3, 1
         13        SEND_VAL                                                 ~7
         14        DO_ICALL                                         $8      
         15        ASSIGN                                                   !3, $8
    6    16        FETCH_DIM_R                                      ~10     !3, 0
         17      > RETURN                                                   ~10
    8    18    > > RETURN                                                   ''
    9    19*     > RETURN                                                   null

End of function getbetween

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.71 ms | 1399 KiB | 18 Q