3v4l.org

run code in 300+ PHP versions simultaneously
<?php $fileContents = <<<TEXT #################### Section One #################### Data A Data B #################### Section Two #################### Data C Data D Data E #################### Section Three #################### Data F TEXT; preg_match_all( '~(?: ^\#{3,}\R \h*(\S+(?:\h\S+)*)\h*\R \#{3,} | \G(?!\A) ) \R (?!\#{3,})(.+) ~mx', $fileContents, $out, PREG_SET_ORDER ); foreach ($out as $set) { $heading = $set[1] ?: $heading; $result[$heading][] = $set[2]; } var_export($result ?? 'No qualifying data');
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 18
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 18
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/6mtjV
function name:  (null)
number of ops:  25
compiled vars:  !0 = $fileContents, !1 = $out, !2 = $set, !3 = $heading, !4 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%0ASection+One%0A%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%0AData+A%0AData+B%0A%0A%0A%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%0A+++Section+Two%0A%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%0AData+C%0AData+D%0AData+E%0A%0A%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%0A+++Section+Three%0A%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%0AData+F'
   24     1        INIT_FCALL                                               'preg_match_all'
   25     2        SEND_VAL                                                 '%7E%28%3F%3A%0A++++++++%5E%5C%23%7B3%2C%7D%5CR%0A++++++++%5Ch%2A%28%5CS%2B%28%3F%3A%5Ch%5CS%2B%29%2A%29%5Ch%2A%5CR%0A++++++++%5C%23%7B3%2C%7D%0A++++++%7C%0A++++++++%5CG%28%3F%21%5CA%29%0A++++++%29%0A++++++%5CR%0A++++++%28%3F%21%5C%23%7B3%2C%7D%29%28.%2B%29%0A+++++%7Emx'
   35     3        SEND_VAR                                                 !0
   36     4        SEND_REF                                                 !1
   37     5        SEND_VAL                                                 2
   24     6        DO_ICALL                                                 
   40     7      > FE_RESET_R                                       $7      !1, ->18
          8    > > FE_FETCH_R                                               $7, !2, ->18
   41     9    >   FETCH_DIM_R                                      ~8      !2, 1
         10        JMP_SET                                          ~9      ~8, ->12
         11        QM_ASSIGN                                        ~9      !3
         12        ASSIGN                                                   !3, ~9
   42    13        FETCH_DIM_R                                      ~13     !2, 2
         14        FETCH_DIM_W                                      $11     !4, !3
         15        ASSIGN_DIM                                               $11
         16        OP_DATA                                                  ~13
   40    17      > JMP                                                      ->8
         18    >   FE_FREE                                                  $7
   44    19        INIT_FCALL                                               'var_export'
         20        COALESCE                                         ~14     !4
         21        QM_ASSIGN                                        ~14     'No+qualifying+data'
         22        SEND_VAL                                                 ~14
         23        DO_ICALL                                                 
         24      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.3 ms | 1012 KiB | 15 Q