3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getStringsBetween($string, $start, $end) { $pattern = sprintf('/%s(.*?)%s/',preg_quote($start), '(?:' . preg_quote($end) . '|$)'); preg_match_all($pattern, $string, $matches); return $matches[1]; } $y = "@!$+$+$+#+ hsjsjenshsjsjsj#hshsjsj ndjdjjdjdn #sem"; $output = getStringsBetween($y, "#", " "); print_r($output);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1oqhc
function name:  (null)
number of ops:  11
compiled vars:  !0 = $y, !1 = $output
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ASSIGN                                                   !0, '%40%21%24%2B%24%2B%24%2B%23%2B+hsjsjenshsjsjsj%23hshsjsj+ndjdjjdjdn+%23sem'
    9     1        INIT_FCALL                                               'getstringsbetween'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 '%23'
          4        SEND_VAL                                                 '+'
          5        DO_FCALL                                      0  $3      
          6        ASSIGN                                                   !1, $3
   10     7        INIT_FCALL                                               'print_r'
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

Function getstringsbetween:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1oqhc
function name:  getStringsBetween
number of ops:  25
compiled vars:  !0 = $string, !1 = $start, !2 = $end, !3 = $pattern, !4 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
    4     3        INIT_FCALL                                               'sprintf'
          4        SEND_VAL                                                 '%2F%25s%28.%2A%3F%29%25s%2F'
          5        INIT_FCALL                                               'preg_quote'
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                         $5      
          8        SEND_VAR                                                 $5
          9        INIT_FCALL                                               'preg_quote'
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                         $6      
         12        CONCAT                                           ~7      '%28%3F%3A', $6
         13        CONCAT                                           ~8      ~7, '%7C%24%29'
         14        SEND_VAL                                                 ~8
         15        DO_ICALL                                         $9      
         16        ASSIGN                                                   !3, $9
    5    17        INIT_FCALL                                               'preg_match_all'
         18        SEND_VAR                                                 !3
         19        SEND_VAR                                                 !0
         20        SEND_REF                                                 !4
         21        DO_ICALL                                                 
    6    22        FETCH_DIM_R                                      ~12     !4, 1
         23      > RETURN                                                   ~12
    7    24*     > RETURN                                                   null

End of function getstringsbetween

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.27 ms | 1403 KiB | 22 Q