3v4l.org

run code in 300+ PHP versions simultaneously
<?php $document = <<<XML <div> <para>text not to match</para> <para>Other line #my_pattern_to_match#, hello world</para> <block> <para>Second test #other_pattern_to_match# in a sub child node</para> </block> </div> XML; $dom = new DOMDocument; $dom->loadXML($document); $paras = $dom->getElementsByTagName('para'); foreach($paras as $para){ if(preg_match('/#(.*?)#/', $para->nodeValue, $match)){ echo $match[1] . PHP_EOL; } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 24
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 24
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 23
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 23
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/imChg
function name:  (null)
number of ops:  26
compiled vars:  !0 = $document, !1 = $dom, !2 = $paras, !3 = $para, !4 = $match
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%3Cdiv%3E%0A++++%3Cpara%3Etext+not+to+match%3C%2Fpara%3E%0A++++%3Cpara%3EOther+line+%23my_pattern_to_match%23%2C+hello+world%3C%2Fpara%3E%0A++++%3Cblock%3E%0A++++++++%3Cpara%3ESecond+test+%23other_pattern_to_match%23+in+a+sub+child+node%3C%2Fpara%3E%0A++++%3C%2Fblock%3E+%0A%3C%2Fdiv%3E'
   11     1        NEW                                              $6      'DOMDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $6
   12     4        INIT_METHOD_CALL                                         !1, 'loadXML'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
   13     7        INIT_METHOD_CALL                                         !1, 'getElementsByTagName'
          8        SEND_VAL_EX                                              'para'
          9        DO_FCALL                                      0  $10     
         10        ASSIGN                                                   !2, $10
   14    11      > FE_RESET_R                                       $12     !2, ->24
         12    > > FE_FETCH_R                                               $12, !3, ->24
   15    13    >   INIT_FCALL                                               'preg_match'
         14        SEND_VAL                                                 '%2F%23%28.%2A%3F%29%23%2F'
         15        FETCH_OBJ_R                                      ~13     !3, 'nodeValue'
         16        SEND_VAL                                                 ~13
         17        SEND_REF                                                 !4
         18        DO_ICALL                                         $14     
         19      > JMPZ                                                     $14, ->23
   16    20    >   FETCH_DIM_R                                      ~15     !4, 1
         21        CONCAT                                           ~16     ~15, '%0A'
         22        ECHO                                                     ~16
   14    23    > > JMP                                                      ->12
         24    >   FE_FREE                                                  $12
   18    25      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
211.93 ms | 1001 KiB | 14 Q