3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = ' #chapter 1: title 1 content chapter 1 line 1 content chapter 1 line 2 content chapter 1 line 3 content chapter 1 line 4 #chapter 2: title 2 content chapter 2 line 1 '; preg_match_all('/#Chapter\h+\d+:\h+title\h+\d+\K(?:\R(?!#chapter).*)*/i',$str, $match); print_r($match[0]);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/28HL5
function name:  (null)
number of ops:  11
compiled vars:  !0 = $str, !1 = $match
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%0A%0A%23chapter+1%3A+title+1%0A%0Acontent+chapter+1+line+1%0Acontent+chapter+1+line+2%0Acontent+chapter+1+line+3%0Acontent+chapter+1+line+4%0A%0A%23chapter+2%3A+title+2%0A%0Acontent+chapter+2+line+1%0A%0A'
   18     1        INIT_FCALL                                               'preg_match_all'
          2        SEND_VAL                                                 '%2F%23Chapter%5Ch%2B%5Cd%2B%3A%5Ch%2Btitle%5Ch%2B%5Cd%2B%5CK%28%3F%3A%5CR%28%3F%21%23chapter%29.%2A%29%2A%2Fi'
          3        SEND_VAR                                                 !0
          4        SEND_REF                                                 !1
          5        DO_ICALL                                                 
   19     6        INIT_FCALL                                               'print_r'
          7        FETCH_DIM_R                                      ~4      !1, 0
          8        SEND_VAL                                                 ~4
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.68 ms | 997 KiB | 15 Q