3v4l.org

run code in 500+ PHP versions simultaneously
<?php $html = <<<STR <html><body> <a href="http://www.test.org/5521" rel="follow">test1</a><br/> <a href="http://www.test.org/5522" rel="external">test1</a><br/> <a href="http://www.test.org/5523">test1</a> </body></html> STR; $dom = new DOMDocument('1.0', 'UTF-8'); $dom->loadHTML($html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); $links = $dom->getElementsByTagName("a"); foreach($links as $link) { $link->setAttribute('rel', 'nofollow'); } echo $dom->saveHTML();
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 15, Position 2 = 21
Branch analysis from position: 15
2 jumps found. (Code = 78) Position 1 = 16, Position 2 = 21
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/27XG3
function name:  (null)
number of ops:  26
compiled vars:  !0 = $html, !1 = $dom, !2 = $links, !3 = $link
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, '%3Chtml%3E%3Cbody%3E%0A%3Ca+href%3D%22http%3A%2F%2Fwww.test.org%2F5521%22+rel%3D%22follow%22%3Etest1%3C%2Fa%3E%3Cbr%2F%3E%0A%3Ca+href%3D%22http%3A%2F%2Fwww.test.org%2F5522%22+rel%3D%22external%22%3Etest1%3C%2Fa%3E%3Cbr%2F%3E%0A%3Ca+href%3D%22http%3A%2F%2Fwww.test.org%2F5523%22%3Etest1%3C%2Fa%3E%0A%3C%2Fbody%3E%3C%2Fhtml%3E'
   11     1        NEW                                                  $5      'DOMDocument'
          2        SEND_VAL_EX                                                  '1.0'
          3        SEND_VAL_EX                                                  'UTF-8'
          4        DO_FCALL                                          0          
          5        ASSIGN                                                       !1, $5
   12     6        INIT_METHOD_CALL                                             !1, 'loadHTML'
          7        SEND_VAR_EX                                                  !0
          8        SEND_VAL_EX                                                  8196
          9        DO_FCALL                                          0          
   13    10        INIT_METHOD_CALL                                             !1, 'getElementsByTagName'
         11        SEND_VAL_EX                                                  'a'
         12        DO_FCALL                                          0  $9      
         13        ASSIGN                                                       !2, $9
   15    14      > FE_RESET_R                                           $11     !2, ->21
         15    > > FE_FETCH_R                                                   $11, !3, ->21
   16    16    >   INIT_METHOD_CALL                                             !3, 'setAttribute'
         17        SEND_VAL_EX                                                  'rel'
         18        SEND_VAL_EX                                                  'nofollow'
         19        DO_FCALL                                          0          
   15    20      > JMP                                                          ->15
         21    >   FE_FREE                                                      $11
   19    22        INIT_METHOD_CALL                                             !1, 'saveHTML'
         23        DO_FCALL                                          0  $13     
         24        ECHO                                                         $13
         25      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
204.51 ms | 2650 KiB | 13 Q