3v4l.org

run code in 300+ PHP versions simultaneously
<?php $pattern = "/(?<=href=(\"|'))[^\"']+(?=(\"|'))/"; $string = "<a class=\"hola\" href=\"link1\">Hola qué tal 1</a>"; $string .= "<a class=\'hola\' href=\'link2\'>Hola qué tal 2</a>"; $string .= "<a class=\"hola\" href=\"link3\">Hola qué tal 3</a>"; $string .= "<a class=\"hola\" href=\"link4\">Hola qué tal 4</a>"; $doc = new DOMDocument(); $doc->loadHTML($string); $tags = $doc->getElementsByTagName("a"); var_dump($tags); foreach($tags as $tag) { $attrs = $tag->getAttributes(); foreach($attrs as $attr) { var_dump($attr); } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 19, Position 2 = 31
Branch analysis from position: 19
2 jumps found. (Code = 78) Position 1 = 20, Position 2 = 31
Branch analysis from position: 20
2 jumps found. (Code = 77) Position 1 = 24, Position 2 = 29
Branch analysis from position: 24
2 jumps found. (Code = 78) Position 1 = 25, Position 2 = 29
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
Branch analysis from position: 29
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
filename:       /in/0okik
function name:  (null)
number of ops:  33
compiled vars:  !0 = $pattern, !1 = $string, !2 = $doc, !3 = $tags, !4 = $tag, !5 = $attrs, !6 = $attr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%2F%28%3F%3C%3Dhref%3D%28%22%7C%27%29%29%5B%5E%22%27%5D%2B%28%3F%3D%28%22%7C%27%29%29%2F'
    3     1        ASSIGN                                                   !1, '%3Ca+class%3D%22hola%22+href%3D%22link1%22%3EHola+qu%C3%A9+tal+1%3C%2Fa%3E'
    4     2        ASSIGN_OP                                     8          !1, '%3Ca+class%3D%5C%27hola%5C%27+href%3D%5C%27link2%5C%27%3EHola+qu%C3%A9+tal+2%3C%2Fa%3E'
    5     3        ASSIGN_OP                                     8          !1, '%3Ca+class%3D%22hola%22+href%3D%22link3%22%3EHola+qu%C3%A9+tal+3%3C%2Fa%3E'
    6     4        ASSIGN_OP                                     8          !1, '%3Ca+class%3D%22hola%22+href%3D%22link4%22%3EHola+qu%C3%A9+tal+4%3C%2Fa%3E'
    7     5        NEW                                              $12     'DOMDocument'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !2, $12
    8     8        INIT_METHOD_CALL                                         !2, 'loadHTML'
          9        SEND_VAR_EX                                              !1
         10        DO_FCALL                                      0          
    9    11        INIT_METHOD_CALL                                         !2, 'getElementsByTagName'
         12        SEND_VAL_EX                                              'a'
         13        DO_FCALL                                      0  $16     
         14        ASSIGN                                                   !3, $16
   10    15        INIT_FCALL                                               'var_dump'
         16        SEND_VAR                                                 !3
         17        DO_ICALL                                                 
   11    18      > FE_RESET_R                                       $19     !3, ->31
         19    > > FE_FETCH_R                                               $19, !4, ->31
   12    20    >   INIT_METHOD_CALL                                         !4, 'getAttributes'
         21        DO_FCALL                                      0  $20     
         22        ASSIGN                                                   !5, $20
   13    23      > FE_RESET_R                                       $22     !5, ->29
         24    > > FE_FETCH_R                                               $22, !6, ->29
   14    25    >   INIT_FCALL                                               'var_dump'
         26        SEND_VAR                                                 !6
         27        DO_ICALL                                                 
   13    28      > JMP                                                      ->24
         29    >   FE_FREE                                                  $22
   11    30      > JMP                                                      ->19
         31    >   FE_FREE                                                  $19
   16    32      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.51 ms | 1400 KiB | 15 Q