3v4l.org

run code in 500+ PHP versions simultaneously
<?php $html = '<a href="blaa..blaa" class="link-wrapper">click here</a><a href="not.blaa" class="something-else">link-3</a> <a href="blaa" class="link-wrapper">link-1</a><a href="blaa..again" class="link-wrapper">link-2</a>'; $doc = new DOMDocument(); $doc->loadHTML($html); $xpath = new DOMXPath($doc); foreach ($xpath->query('//a[contains(@class, "link-wrapper")]') as $a) { $urls[] = $a->attributes->getNamedItem('href')->nodeValue; } foreach ($urls as $url) { echo "$url\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 15, Position 2 = 24
Branch analysis from position: 15
2 jumps found. (Code = 78) Position 1 = 16, Position 2 = 24
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 24
2 jumps found. (Code = 77) Position 1 = 26, Position 2 = 31
Branch analysis from position: 26
2 jumps found. (Code = 78) Position 1 = 27, Position 2 = 31
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
Branch analysis from position: 24
filename:       /in/g3iIO
function name:  (null)
number of ops:  33
compiled vars:  !0 = $html, !1 = $doc, !2 = $xpath, !3 = $a, !4 = $urls, !5 = $url
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, '%3Ca+href%3D%22blaa..blaa%22+class%3D%22link-wrapper%22%3Eclick+here%3C%2Fa%3E%3Ca+href%3D%22not.blaa%22+class%3D%22something-else%22%3Elink-3%3C%2Fa%3E%0A%3Ca+href%3D%22blaa%22+class%3D%22link-wrapper%22%3Elink-1%3C%2Fa%3E%3Ca+href%3D%22blaa..again%22+class%3D%22link-wrapper%22%3Elink-2%3C%2Fa%3E'
    5     1        NEW                                                  $7      'DOMDocument'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !1, $7
    6     4        INIT_METHOD_CALL                                             !1, 'loadHTML'
          5        SEND_VAR_EX                                                  !0
          6        DO_FCALL                                          0          
    7     7        NEW                                                  $11     'DOMXPath'
          8        SEND_VAR_EX                                                  !1
          9        DO_FCALL                                          0          
         10        ASSIGN                                                       !2, $11
    8    11        INIT_METHOD_CALL                                             !2, 'query'
         12        SEND_VAL_EX                                                  '%2F%2Fa%5Bcontains%28%40class%2C+%22link-wrapper%22%29%5D'
         13        DO_FCALL                                          0  $14     
         14      > FE_RESET_R                                           $15     $14, ->24
         15    > > FE_FETCH_R                                                   $15, !3, ->24
    9    16    >   FETCH_OBJ_R                                          ~17     !3, 'attributes'
         17        INIT_METHOD_CALL                                             ~17, 'getNamedItem'
         18        SEND_VAL_EX                                                  'href'
         19        DO_FCALL                                          0  $18     
         20        FETCH_OBJ_R                                          ~19     $18, 'nodeValue'
         21        ASSIGN_DIM                                                   !4
         22        OP_DATA                                                      ~19
    8    23      > JMP                                                          ->15
         24    >   FE_FREE                                                      $15
   11    25      > FE_RESET_R                                           $20     !4, ->31
         26    > > FE_FETCH_R                                                   $20, !5, ->31
   12    27    >   NOP                                                          
         28        FAST_CONCAT                                          ~21     !5, '%0A'
         29        ECHO                                                         ~21
   11    30      > JMP                                                          ->26
         31    >   FE_FREE                                                      $20
   13    32      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
213.16 ms | 2052 KiB | 13 Q