3v4l.org

run code in 500+ 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 = 46
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 46
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 46
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 46
filename:       /in/aniWJ
function name:  (null)
number of ops:  48
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, ->46
         16    > > FE_FETCH_R                                                   $19, !4, ->46
   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_METHOD_CALL                                             !5, 'item'
         23        SEND_VAL_EX                                                  0
         24        DO_FCALL                                          0  $22     
         25        FETCH_OBJ_R                                          ~23     $22, 'textContent'
         26        FRAMELESS_ICALL_3                preg_replace        ~24     '%2FImpact%3A%5CW%2A%2F', ''
         27        OP_DATA                                                      ~23
         28        ASSIGN                                                       !6, ~24
   17    29        CONCAT                                               ~26     !6, '%0A'
         30        ECHO                                                         ~26
   18    31        INIT_METHOD_CALL                                             !2, 'query'
         32        SEND_VAL_EX                                                  '%2F%2Fli%5Bcontains%28string%28%29%2C+%22Severity%3A%22%29%5D'
         33        SEND_VAR_EX                                                  !4
         34        DO_FCALL                                          0  $27     
         35        ASSIGN                                                       !7, $27
   19    36        INIT_METHOD_CALL                                             !7, 'item'
         37        SEND_VAL_EX                                                  0
         38        DO_FCALL                                          0  $29     
         39        FETCH_OBJ_R                                          ~30     $29, 'textContent'
         40        FRAMELESS_ICALL_3                preg_replace        ~31     '%2FSeverity%3A%5CW%2A%2Fu', ''
         41        OP_DATA                                                      ~30
         42        ASSIGN                                                       !8, ~31
   20    43        CONCAT                                               ~33     !8, '%0A'
         44        ECHO                                                         ~33
   14    45      > JMP                                                          ->16
         46    >   FE_FREE                                                      $19
   21    47      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
173.27 ms | 2038 KiB | 14 Q