3v4l.org

run code in 500+ PHP versions simultaneously
<?php $string = <<<TEXT [Beginning] ABC [Ending] [Beginning] DEF [Ending] [Beginning] GHI [Ending] [Beginning] JKL [Ending] [Beginning] MNO [Ending] TEXT; preg_match_all('/^' . preg_quote('[Beginning]') . '[\r\n]+(.*)[\r\n]+' . preg_quote('[Ending]') . '$/m', $string, $matches); print_r($matches);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/v5d2p
function name:  (null)
number of ops:  20
compiled vars:  !0 = $string, !1 = $matches
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, '%5BBeginning%5D%0AABC%0A%5BEnding%5D%0A%0A%5BBeginning%5D%0ADEF%0A%5BEnding%5D%0A%0A%0A%5BBeginning%5D%0AGHI%0A%5BEnding%5D%0A%0A%0A%5BBeginning%5D%0AJKL%0A%5BEnding%5D%0A%0A%5BBeginning%5D%0AMNO%0A%5BEnding%5D'
   27     1        INIT_FCALL                                                   'preg_match_all'
          2        INIT_FCALL                                                   'preg_quote'
          3        SEND_VAL                                                     '%5BBeginning%5D'
          4        DO_ICALL                                             $3      
          5        CONCAT                                               ~4      '%2F%5E', $3
          6        CONCAT                                               ~5      ~4, '%5B%5Cr%5Cn%5D%2B%28.%2A%29%5B%5Cr%5Cn%5D%2B'
          7        INIT_FCALL                                                   'preg_quote'
          8        SEND_VAL                                                     '%5BEnding%5D'
          9        DO_ICALL                                             $6      
         10        CONCAT                                               ~7      ~5, $6
         11        CONCAT                                               ~8      ~7, '%24%2Fm'
         12        SEND_VAL                                                     ~8
         13        SEND_VAR                                                     !0
         14        SEND_REF                                                     !1
         15        DO_ICALL                                                     
   29    16        INIT_FCALL                                                   'print_r'
         17        SEND_VAR                                                     !1
         18        DO_ICALL                                                     
         19      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
167.43 ms | 2138 KiB | 15 Q