3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<HTML <div> <h1>title</h1> and <h2>title 2</h2> <h2 data-formula="a > b" class="regex_is_DOM_unaware">Monkeywrench</h2> <h1 class="classname">test <span>This isn't even a </h tag</span></h1> </div> HTML; var_export( preg_match_all( '|<\s*h[1-2](?:.*)>(.*)</\s*h|Ui', $html, $matches ) ? $matches[1] // capture group 1 : [] ); /* Desired result but not what is provided: array ( 0 => 'title', 1 => 'title 2', 2 => 'Monkeywrench', 3 => 'test <span>This isn't even a </h tag</span>' ) */
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 11
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LXXSQ
function name:  (null)
number of ops:  15
compiled vars:  !0 = $html, !1 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3Cdiv%3E%0A%3Ch1%3Etitle%3C%2Fh1%3E+and+%3Ch2%3Etitle+2%3C%2Fh2%3E%0A%3Ch2+data-formula%3D%22a+%3E+b%22+class%3D%22regex_is_DOM_unaware%22%3EMonkeywrench%3C%2Fh2%3E%0A%3Ch1+class%3D%22classname%22%3Etest+%3Cspan%3EThis+isn%27t+even+a+%3C%2Fh+tag%3C%2Fspan%3E%3C%2Fh1%3E%0A%3C%2Fdiv%3E'
   11     1        INIT_FCALL                                               'var_export'
   12     2        INIT_FCALL                                               'preg_match_all'
   13     3        SEND_VAL                                                 '%7C%3C%5Cs%2Ah%5B1-2%5D%28%3F%3A.%2A%29%3E%28.%2A%29%3C%2F%5Cs%2Ah%7CUi'
   14     4        SEND_VAR                                                 !0
   15     5        SEND_REF                                                 !1
   12     6        DO_ICALL                                         $3      
   15     7      > JMPZ                                                     $3, ->11
   17     8    >   FETCH_DIM_R                                      ~4      !1, 1
          9        QM_ASSIGN                                        ~5      ~4
         10      > JMP                                                      ->12
   18    11    >   QM_ASSIGN                                        ~5      <array>
         12    >   SEND_VAL                                                 ~5
   11    13        DO_ICALL                                                 
   30    14      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.55 ms | 1433 KiB | 15 Q