3v4l.org

run code in 500+ PHP versions simultaneously
<?php $string = <<<DATA <li class="four-column mosaicElement"> <a href="https://example.com" title="Lorem ipsum"> </a> </li> <li class="four-column mosaicElement"> <a href="https://example.org" title="Lorem ipsum"> </a> </li> DATA; $dom = new DOMDocument(); $dom->loadHTML($string); $xpath = new DOMXpath($dom); foreach($xpath->query("//li[contains(@class, 'four-column') and contains(@class, 'mosaicElement')]/a") as $v) { echo $v->getAttribute("href") . PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 15, Position 2 = 22
Branch analysis from position: 15
2 jumps found. (Code = 78) Position 1 = 16, Position 2 = 22
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/iuhmP
function name:  (null)
number of ops:  24
compiled vars:  !0 = $string, !1 = $dom, !2 = $xpath, !3 = $v
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, '%3Cli+class%3D%22four-column+mosaicElement%22%3E%0A%3Ca+href%3D%22https%3A%2F%2Fexample.com%22+title%3D%22Lorem+ipsum%22%3E%0A%3C%2Fa%3E%0A%3C%2Fli%3E%0A%3Cli+class%3D%22four-column+mosaicElement%22%3E%0A%3Ca+href%3D%22https%3A%2F%2Fexample.org%22+title%3D%22Lorem+ipsum%22%3E%0A%3C%2Fa%3E%0A%3C%2Fli%3E'
   14     1        NEW                                                  $5      'DOMDocument'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !1, $5
   15     4        INIT_METHOD_CALL                                             !1, 'loadHTML'
          5        SEND_VAR_EX                                                  !0
          6        DO_FCALL                                          0          
   16     7        NEW                                                  $9      'DOMXpath'
          8        SEND_VAR_EX                                                  !1
          9        DO_FCALL                                          0          
         10        ASSIGN                                                       !2, $9
   18    11        INIT_METHOD_CALL                                             !2, 'query'
         12        SEND_VAL_EX                                                  '%2F%2Fli%5Bcontains%28%40class%2C+%27four-column%27%29+and+contains%28%40class%2C+%27mosaicElement%27%29%5D%2Fa'
         13        DO_FCALL                                          0  $12     
         14      > FE_RESET_R                                           $13     $12, ->22
         15    > > FE_FETCH_R                                                   $13, !3, ->22
   19    16    >   INIT_METHOD_CALL                                             !3, 'getAttribute'
         17        SEND_VAL_EX                                                  'href'
         18        DO_FCALL                                          0  $14     
         19        CONCAT                                               ~15     $14, '%0A'
         20        ECHO                                                         ~15
   18    21      > JMP                                                          ->15
         22    >   FE_FREE                                                      $13
   20    23      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
159.43 ms | 2047 KiB | 13 Q