3v4l.org

run code in 300+ PHP versions simultaneously
<?php libxml_use_internal_errors(true); // to disable warnings if HTML is not well formed $o = new DOMDocument(); $o->loadHTML('<a href="../plugins/re_records/somefile.php?page=something&id=45">important_name</a>'); foreach($o->getElementsByTagName('a') as $anchor_tag){ $href = $anchor_tag->getAttribute('href'); if(strpos($href,'/plugins/re_records/somefile.php?page=something&id=') !== false){ $anchor_tag->setAttribute('href','/map/'.$anchor_tag->nodeValue); } } echo $o->saveHTML();
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 31
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 31
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 30
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 30
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
filename:       /in/5GPXA
function name:  (null)
number of ops:  36
compiled vars:  !0 = $o, !1 = $anchor_tag, !2 = $href
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'libxml_use_internal_errors'
          1        SEND_VAL                                                 <true>
          2        DO_ICALL                                                 
    4     3        NEW                                              $4      'DOMDocument'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $4
    5     6        INIT_METHOD_CALL                                         !0, 'loadHTML'
          7        SEND_VAL_EX                                              '%3Ca+href%3D%22..%2Fplugins%2Fre_records%2Fsomefile.php%3Fpage%3Dsomething%26id%3D45%22%3Eimportant_name%3C%2Fa%3E'
          8        DO_FCALL                                      0          
    7     9        INIT_METHOD_CALL                                         !0, 'getElementsByTagName'
         10        SEND_VAL_EX                                              'a'
         11        DO_FCALL                                      0  $8      
         12      > FE_RESET_R                                       $9      $8, ->31
         13    > > FE_FETCH_R                                               $9, !1, ->31
    8    14    >   INIT_METHOD_CALL                                         !1, 'getAttribute'
         15        SEND_VAL_EX                                              'href'
         16        DO_FCALL                                      0  $10     
         17        ASSIGN                                                   !2, $10
    9    18        INIT_FCALL                                               'strpos'
         19        SEND_VAR                                                 !2
         20        SEND_VAL                                                 '%2Fplugins%2Fre_records%2Fsomefile.php%3Fpage%3Dsomething%26id%3D'
         21        DO_ICALL                                         $12     
         22        TYPE_CHECK                                  1018          $12
         23      > JMPZ                                                     ~13, ->30
   10    24    >   INIT_METHOD_CALL                                         !1, 'setAttribute'
         25        SEND_VAL_EX                                              'href'
         26        FETCH_OBJ_R                                      ~14     !1, 'nodeValue'
         27        CONCAT                                           ~15     '%2Fmap%2F', ~14
         28        SEND_VAL_EX                                              ~15
         29        DO_FCALL                                      0          
    7    30    > > JMP                                                      ->13
         31    >   FE_FREE                                                  $9
   14    32        INIT_METHOD_CALL                                         !0, 'saveHTML'
         33        DO_FCALL                                      0  $17     
         34        ECHO                                                     $17
         35      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
263.09 ms | 1012 KiB | 15 Q