3v4l.org

run code in 300+ PHP versions simultaneously
<?php function string_between($string, $start, $end) { $parts = explode($start, $string); if (isset($parts[1])) { $parts = explode($end, $parts[1]); return $parts[0]; } return null; } echo string_between('volume: 90%', 'volume: ', '%');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Vn1ds
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_FCALL                                               'string_between'
          1        SEND_VAL                                                 'volume%3A+90%25'
          2        SEND_VAL                                                 'volume%3A+'
          3        SEND_VAL                                                 '%25'
          4        DO_FCALL                                      0  $0      
          5        ECHO                                                     $0
          6      > RETURN                                                   1

Function string_between:
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/Vn1ds
function name:  string_between
number of ops:  20
compiled vars:  !0 = $string, !1 = $start, !2 = $end, !3 = $parts
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
    4     3        INIT_FCALL                                               'explode'
          4        SEND_VAR                                                 !1
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $4      
          7        ASSIGN                                                   !3, $4
    6     8        ISSET_ISEMPTY_DIM_OBJ                         0          !3, 1
          9      > JMPZ                                                     ~6, ->18
    7    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
    9    16        FETCH_DIM_R                                      ~10     !3, 0
         17      > RETURN                                                   ~10
   12    18    > > RETURN                                                   null
   13    19*     > RETURN                                                   null

End of function string_between

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.12 ms | 1403 KiB | 16 Q