3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = '<div class="feed-item-description"> <ul> <li><strong>Impact:</strong>&nbsp;Low</li> <li><strong>Severity:</strong> <span class="label label-info">Low</span></li> </ul> </div>'; $doc = new DOMDocument(); $doc->loadHTML($html); $xpath = new DOMXPath($doc); $feed_items = $xpath->query('//div[contains(@class, "feed-item-description")]'); foreach ($feed_items as $fi) { $impact_node = $xpath->query('//li[contains(string(), "Impact:")]', $fi); $impact = preg_replace('/Impact:\W*/', '', $impact_node->item(0)->textContent); echo $impact . "\n"; $severity_node = $xpath->query('//li[contains(string(), "Severity:")]', $fi); $severity = preg_replace('/Severity:\W*/u', '', $severity_node->item(0)->textContent); echo $severity . "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 52
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 52
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 52
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 52
filename:       /in/aniWJ
function name:  (null)
number of ops:  54
compiled vars:  !0 = $html, !1 = $doc, !2 = $xpath, !3 = $feed_items, !4 = $fi, !5 = $impact_node, !6 = $impact, !7 = $severity_node, !8 = $severity
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3Cdiv+class%3D%22feed-item-description%22%3E%0A%3Cul%3E%0A%3Cli%3E%3Cstrong%3EImpact%3A%3C%2Fstrong%3E%26nbsp%3BLow%3C%2Fli%3E%0A%3Cli%3E%3Cstrong%3ESeverity%3A%3C%2Fstrong%3E+%3Cspan+class%3D%22label+label-info%22%3ELow%3C%2Fspan%3E%3C%2Fli%3E%0A%3C%2Ful%3E%0A%3C%2Fdiv%3E'
   10     1        NEW                                              $10     'DOMDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $10
   11     4        INIT_METHOD_CALL                                         !1, 'loadHTML'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
   12     7        NEW                                              $14     'DOMXPath'
          8        SEND_VAR_EX                                              !1
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !2, $14
   13    11        INIT_METHOD_CALL                                         !2, 'query'
         12        SEND_VAL_EX                                              '%2F%2Fdiv%5Bcontains%28%40class%2C+%22feed-item-description%22%29%5D'
         13        DO_FCALL                                      0  $17     
         14        ASSIGN                                                   !3, $17
   14    15      > FE_RESET_R                                       $19     !3, ->52
         16    > > FE_FETCH_R                                               $19, !4, ->52
   15    17    >   INIT_METHOD_CALL                                         !2, 'query'
         18        SEND_VAL_EX                                              '%2F%2Fli%5Bcontains%28string%28%29%2C+%22Impact%3A%22%29%5D'
         19        SEND_VAR_EX                                              !4
         20        DO_FCALL                                      0  $20     
         21        ASSIGN                                                   !5, $20
   16    22        INIT_FCALL                                               'preg_replace'
         23        SEND_VAL                                                 '%2FImpact%3A%5CW%2A%2F'
         24        SEND_VAL                                                 ''
         25        INIT_METHOD_CALL                                         !5, 'item'
         26        SEND_VAL_EX                                              0
         27        DO_FCALL                                      0  $22     
         28        FETCH_OBJ_R                                      ~23     $22, 'textContent'
         29        SEND_VAL                                                 ~23
         30        DO_ICALL                                         $24     
         31        ASSIGN                                                   !6, $24
   17    32        CONCAT                                           ~26     !6, '%0A'
         33        ECHO                                                     ~26
   18    34        INIT_METHOD_CALL                                         !2, 'query'
         35        SEND_VAL_EX                                              '%2F%2Fli%5Bcontains%28string%28%29%2C+%22Severity%3A%22%29%5D'
         36        SEND_VAR_EX                                              !4
         37        DO_FCALL                                      0  $27     
         38        ASSIGN                                                   !7, $27
   19    39        INIT_FCALL                                               'preg_replace'
         40        SEND_VAL                                                 '%2FSeverity%3A%5CW%2A%2Fu'
         41        SEND_VAL                                                 ''
         42        INIT_METHOD_CALL                                         !7, 'item'
         43        SEND_VAL_EX                                              0
         44        DO_FCALL                                      0  $29     
         45        FETCH_OBJ_R                                      ~30     $29, 'textContent'
         46        SEND_VAL                                                 ~30
         47        DO_ICALL                                         $31     
         48        ASSIGN                                                   !8, $31
   20    49        CONCAT                                           ~33     !8, '%0A'
         50        ECHO                                                     ~33
   14    51      > JMP                                                      ->16
         52    >   FE_FREE                                                  $19
   21    53      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.76 ms | 1007 KiB | 14 Q