3v4l.org

run code in 500+ PHP versions simultaneously
<?php $html = <<<HTML <div> <wiki href="articletitle">Text</wiki> </div> HTML; $appPath = 'http://myapps/page/'; $dom = new DOMDocument; libxml_use_internal_errors(true); $dom->loadHTML($html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); foreach ($dom->getElementsByTagName('wiki') as $wiki) { $a = $dom->createElement('a'); $a->setAttribute('href', $appPath . $wiki->getAttribute('href')); $a->nodeValue = $wiki->nodeValue; $wiki->parentNode->replaceChild($a, $wiki); } echo $dom->saveHTML();
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 38
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 38
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 38
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 38
filename:       /in/FKcle
function name:  (null)
number of ops:  43
compiled vars:  !0 = $html, !1 = $appPath, !2 = $dom, !3 = $wiki, !4 = $a
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, '%3Cdiv%3E%0A++++%3Cwiki+href%3D%22articletitle%22%3EText%3C%2Fwiki%3E%0A%3C%2Fdiv%3E'
    8     1        ASSIGN                                                       !1, 'http%3A%2F%2Fmyapps%2Fpage%2F'
   10     2        NEW                                                  $7      'DOMDocument'
          3        DO_FCALL                                          0          
          4        ASSIGN                                                       !2, $7
   11     5        INIT_FCALL                                                   'libxml_use_internal_errors'
          6        SEND_VAL                                                     <true>
          7        DO_ICALL                                                     
   12     8        INIT_METHOD_CALL                                             !2, 'loadHTML'
          9        SEND_VAR_EX                                                  !0
         10        SEND_VAL_EX                                                  8196
         11        DO_FCALL                                          0          
   13    12        INIT_METHOD_CALL                                             !2, 'getElementsByTagName'
         13        SEND_VAL_EX                                                  'wiki'
         14        DO_FCALL                                          0  $12     
         15      > FE_RESET_R                                           $13     $12, ->38
         16    > > FE_FETCH_R                                                   $13, !3, ->38
   14    17    >   INIT_METHOD_CALL                                             !2, 'createElement'
         18        SEND_VAL_EX                                                  'a'
         19        DO_FCALL                                          0  $14     
         20        ASSIGN                                                       !4, $14
   15    21        INIT_METHOD_CALL                                             !4, 'setAttribute'
         22        SEND_VAL_EX                                                  'href'
         23        INIT_METHOD_CALL                                             !3, 'getAttribute'
         24        SEND_VAL_EX                                                  'href'
         25        DO_FCALL                                          0  $16     
         26        CONCAT                                               ~17     !1, $16
         27        SEND_VAL_EX                                                  ~17
         28        DO_FCALL                                          0          
   16    29        FETCH_OBJ_R                                          ~20     !3, 'nodeValue'
         30        ASSIGN_OBJ                                                   !4, 'nodeValue'
         31        OP_DATA                                                      ~20
   17    32        FETCH_OBJ_R                                          ~21     !3, 'parentNode'
         33        INIT_METHOD_CALL                                             ~21, 'replaceChild'
         34        SEND_VAR_EX                                                  !4
         35        SEND_VAR_EX                                                  !3
         36        DO_FCALL                                          0          
   13    37      > JMP                                                          ->16
         38    >   FE_FREE                                                      $13
   19    39        INIT_METHOD_CALL                                             !2, 'saveHTML'
         40        DO_FCALL                                          0  $23     
         41        ECHO                                                         $23
         42      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
163.49 ms | 2215 KiB | 14 Q