3v4l.org

run code in 500+ 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                                                   'preg_quote'
          4        SEND_VAR                                                     !1
          5        DO_ICALL                                             $5      
          6        INIT_FCALL                                                   'preg_quote'
          7        SEND_VAR                                                     !2
          8        DO_ICALL                                             $6      
          9        CONCAT                                               ~7      '%28%3F%3A', $6
         10        CONCAT                                               ~8      ~7, '%7C%24%29'
         11        ROPE_INIT                                         5  ~10     '%2F'
         12        ROPE_ADD                                          1  ~10     ~10, $5
         13        ROPE_ADD                                          2  ~10     ~10, '%28.%2A%3F%29'
         14        ROPE_ADD                                          3  ~10     ~10, ~8
         15        ROPE_END                                          4  ~9      ~10, '%2F'
         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                                          ~15     !4, 1
         23      > RETURN                                                       ~15
    7    24*     > RETURN                                                       null

End of function getstringsbetween

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
150.06 ms | 2182 KiB | 17 Q