3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<EOF this is the <a href='#'>test link</a> here and <a href='#'>there</a>. EOF; $dom = new DOMDocument(); $dom->loadHTML($html); $atags=$dom->getElementsByTagName('a'); foreach($atags as $atag) { $text = $atag->firstChild->cloneNode(); $r = $atag->parentNode->replaceChild($text, $atag); } echo $dom->saveHTML();
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 24
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 24
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/PeXDg
function name:  (null)
number of ops:  29
compiled vars:  !0 = $html, !1 = $dom, !2 = $atags, !3 = $atag, !4 = $text, !5 = $r
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'this+is+the+%3Ca+href%3D%27%23%27%3Etest+link%3C%2Fa%3E+here+and+%3Ca+href%3D%27%23%27%3Ethere%3C%2Fa%3E.'
    7     1        NEW                                              $7      'DOMDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $7
    8     4        INIT_METHOD_CALL                                         !1, 'loadHTML'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
    9     7        INIT_METHOD_CALL                                         !1, 'getElementsByTagName'
          8        SEND_VAL_EX                                              'a'
          9        DO_FCALL                                      0  $11     
         10        ASSIGN                                                   !2, $11
   11    11      > FE_RESET_R                                       $13     !2, ->24
         12    > > FE_FETCH_R                                               $13, !3, ->24
   12    13    >   FETCH_OBJ_R                                      ~14     !3, 'firstChild'
         14        INIT_METHOD_CALL                                         ~14, 'cloneNode'
         15        DO_FCALL                                      0  $15     
         16        ASSIGN                                                   !4, $15
   13    17        FETCH_OBJ_R                                      ~17     !3, 'parentNode'
         18        INIT_METHOD_CALL                                         ~17, 'replaceChild'
         19        SEND_VAR_EX                                              !4
         20        SEND_VAR_EX                                              !3
         21        DO_FCALL                                      0  $18     
         22        ASSIGN                                                   !5, $18
   11    23      > JMP                                                      ->12
         24    >   FE_FREE                                                  $13
   16    25        INIT_METHOD_CALL                                         !1, 'saveHTML'
         26        DO_FCALL                                      0  $20     
         27        ECHO                                                     $20
         28      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.6 ms | 1395 KiB | 13 Q