3v4l.org

run code in 500+ PHP versions simultaneously
<?php $re = '/^#%META((?>\R(?!#%(?:META|ENDS)$).*)+)\R#%ENDS$/m'; $str = '#%META # date: 2022-08-27 # generated-by: Me # id: 1 #%ENDS #%BODY .... #%ENDS #%META # date: 2022-08-27 # generated-by: Another Me # id: 2 #%ENDS #%BODY .... #%ENDS'; if (preg_match_all($re, $str, $matches)) { $result = array_map(function ($s) { return preg_replace("/^#\h*/m", "", trim($s)); }, $matches[1]); var_export($result); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 18
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/5A2Zu
function name:  (null)
number of ops:  19
compiled vars:  !0 = $re, !1 = $str, !2 = $matches, !3 = $result
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, '%2F%5E%23%25META%28%28%3F%3E%5CR%28%3F%21%23%25%28%3F%3AMETA%7CENDS%29%24%29.%2A%29%2B%29%5CR%23%25ENDS%24%2Fm'
    4     1        ASSIGN                                                       !1, '%23%25META%0A%23+date%3A+2022-08-27%0A%23+generated-by%3A+Me%0A%23+id%3A+1%0A%23%25ENDS%0A%0A%23%25BODY%0A....%0A%23%25ENDS%0A%0A%23%25META%0A%23+date%3A+2022-08-27%0A%23+generated-by%3A+Another+Me%0A%23+id%3A+2%0A%23%25ENDS%0A%0A%23%25BODY%0A....%0A%23%25ENDS'
   24     2        INIT_FCALL                                                   'preg_match_all'
          3        SEND_VAR                                                     !0
          4        SEND_VAR                                                     !1
          5        SEND_REF                                                     !2
          6        DO_ICALL                                             $6      
          7      > JMPZ                                                         $6, ->18
   25     8    >   INIT_FCALL                                                   'array_map'
          9        DECLARE_LAMBDA_FUNCTION                              ~7      [0]
   27    10        SEND_VAL                                                     ~7
         11        FETCH_DIM_R                                          ~8      !2, 1
         12        SEND_VAL                                                     ~8
   25    13        DO_ICALL                                             $9      
         14        ASSIGN                                                       !3, $9
   28    15        INIT_FCALL                                                   'var_export'
         16        SEND_VAR                                                     !3
         17        DO_ICALL                                                     
   29    18    > > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5A2Zu
function name:  {closure:/in/5A2Zu:25}
number of ops:  6
compiled vars:  !0 = $s
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   25     0  E >   RECV                                                 !0      
   26     1        FRAMELESS_ICALL_1                trim                ~1      !0
          2        FRAMELESS_ICALL_3                preg_replace        ~2      '%2F%5E%23%5Ch%2A%2Fm', ''
          3        OP_DATA                                                      ~1
          4      > RETURN                                                       ~2
   27     5*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
169.56 ms | 1900 KiB | 16 Q