3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = <<<FOO #Doc 1 ## #Doc1.1 #Doc 1.2 mine_sht : carftj ### 漢字漢字貔貅 (Random chinese symbols) tv: tee # # HI tvw: 9 #Inline doc #aa 9abaa: ahah #heuens FOO; preg_match_all('~^\s*(?:(\w+)\s*:.[^\r\n#]*([^\r\n]*#*)?)?(#*(?:[^\r\n]|[\r\n]#)*)~um', $data, $matches); ///print_r($matches); $doc = ""; foreach($matches[1] as $i => $m) { $s = preg_replace('/\s+/', '', $m); //Remove whitespace if (str_starts_with($s, "#") || empty($s)){ //Valid next comment line $doc .= $matches[3][$i] . PHP_EOL; //Adding comments //print("DOC LOG: " . $doc . PHP_EOL); //LOG DOC continue; } print("KEY:\n" . $m . "\nDOC:\n" . $doc . "\nIDOC:\n" . $matches[2][$i] . "\n"); print("--------------------------------------------------\n"); $doc = $matches[3][$i]; //print("OPEN: ". $m . "-CLOSED\n"); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 44
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 44
Branch analysis from position: 10
2 jumps found. (Code = 47) Position 1 = 22, Position 2 = 24
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 30
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 24
Branch analysis from position: 44
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 44
filename:       /in/KYoCe
function name:  (null)
number of ops:  46
compiled vars:  !0 = $data, !1 = $matches, !2 = $doc, !3 = $m, !4 = $i, !5 = $s
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%23Doc+1%0A%0A%23%23+++++++%23Doc1.1%0A%23Doc+1.2%0Amine_sht++++%3A++++++++carftj+%23%23%23++++%E6%BC%A2%E5%AD%97%E6%BC%A2%E5%AD%97%E8%B2%94%E8%B2%85+%28Random+chinese+symbols%29%0A++++tv%3A+tee+%23+%23+HI%0Atvw%3A+9++%23Inline+doc%0A%23aa%0A9abaa%3A+ahah%0A%0A%23heuens'
   15     1        INIT_FCALL                                               'preg_match_all'
          2        SEND_VAL                                                 '%7E%5E%5Cs%2A%28%3F%3A%28%5Cw%2B%29%5Cs%2A%3A.%5B%5E%5Cr%5Cn%23%5D%2A%28%5B%5E%5Cr%5Cn%5D%2A%23%2A%29%3F%29%3F%28%23%2A%28%3F%3A%5B%5E%5Cr%5Cn%5D%7C%5B%5Cr%5Cn%5D%23%29%2A%29%7Eum'
          3        SEND_VAR                                                 !0
          4        SEND_REF                                                 !1
          5        DO_ICALL                                                 
   17     6        ASSIGN                                                   !2, ''
   18     7        FETCH_DIM_R                                      ~9      !1, 1
          8      > FE_RESET_R                                       $10     ~9, ->44
          9    > > FE_FETCH_R                                       ~11     $10, !3, ->44
         10    >   ASSIGN                                                   !4, ~11
   19    11        INIT_FCALL                                               'preg_replace'
         12        SEND_VAL                                                 '%2F%5Cs%2B%2F'
         13        SEND_VAL                                                 ''
         14        SEND_VAR                                                 !3
         15        DO_ICALL                                         $13     
         16        ASSIGN                                                   !5, $13
   20    17        INIT_FCALL                                               'str_starts_with'
         18        SEND_VAR                                                 !5
         19        SEND_VAL                                                 '%23'
         20        DO_ICALL                                         $15     
         21      > JMPNZ_EX                                         ~16     $15, ->24
         22    >   ISSET_ISEMPTY_CV                                 ~17     !5
         23        BOOL                                             ~16     ~17
         24    > > JMPZ                                                     ~16, ->30
   21    25    >   FETCH_DIM_R                                      ~18     !1, 3
         26        FETCH_DIM_R                                      ~19     ~18, !4
         27        CONCAT                                           ~20     ~19, '%0A'
         28        ASSIGN_OP                                     8          !2, ~20
   23    29      > JMP                                                      ->9
   25    30    >   CONCAT                                           ~22     'KEY%3A%0A', !3
         31        CONCAT                                           ~23     ~22, '%0ADOC%3A%0A'
         32        CONCAT                                           ~24     ~23, !2
         33        CONCAT                                           ~25     ~24, '%0AIDOC%3A%0A'
         34        FETCH_DIM_R                                      ~26     !1, 2
         35        FETCH_DIM_R                                      ~27     ~26, !4
         36        CONCAT                                           ~28     ~25, ~27
         37        CONCAT                                           ~29     ~28, '%0A'
         38        ECHO                                                     ~29
   26    39        ECHO                                                     '--------------------------------------------------%0A'
   27    40        FETCH_DIM_R                                      ~30     !1, 3
         41        FETCH_DIM_R                                      ~31     ~30, !4
         42        ASSIGN                                                   !2, ~31
   18    43      > JMP                                                      ->9
         44    >   FE_FREE                                                  $10
   29    45      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.9 ms | 1439 KiB | 16 Q