3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = "<link rel='stylesheet' href='foo.com/bar/baz.min.css' type='text/css' id='23434' foo='bar' media='all'/>"; $dom = new DOMDocument(); $dom->loadHTML($html); $selector = new DOMXPath($dom); foreach($selector->select('//link[@type="text/css"]') as $link) { $link->removeAttribute('id'); $link->removeAttribute('media'); } echo $dom->saveHTML();
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 15, Position 2 = 23
Branch analysis from position: 15
2 jumps found. (Code = 78) Position 1 = 16, Position 2 = 23
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/Ubua4
function name:  (null)
number of ops:  28
compiled vars:  !0 = $html, !1 = $dom, !2 = $selector, !3 = $link
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, '%3Clink+rel%3D%27stylesheet%27+href%3D%27foo.com%2Fbar%2Fbaz.min.css%27+type%3D%27text%2Fcss%27+id%3D%2723434%27+foo%3D%27bar%27+media%3D%27all%27%2F%3E'
    6     1        NEW                                              $5      'DOMDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $5
    7     4        INIT_METHOD_CALL                                         !1, 'loadHTML'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
    9     7        NEW                                              $9      'DOMXPath'
          8        SEND_VAR_EX                                              !1
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !2, $9
   11    11        INIT_METHOD_CALL                                         !2, 'select'
         12        SEND_VAL_EX                                              '%2F%2Flink%5B%40type%3D%22text%2Fcss%22%5D'
         13        DO_FCALL                                      0  $12     
         14      > FE_RESET_R                                       $13     $12, ->23
         15    > > FE_FETCH_R                                               $13, !3, ->23
   12    16    >   INIT_METHOD_CALL                                         !3, 'removeAttribute'
         17        SEND_VAL_EX                                              'id'
         18        DO_FCALL                                      0          
   13    19        INIT_METHOD_CALL                                         !3, 'removeAttribute'
         20        SEND_VAL_EX                                              'media'
         21        DO_FCALL                                      0          
   11    22      > JMP                                                      ->15
         23    >   FE_FREE                                                  $13
   16    24        INIT_METHOD_CALL                                         !1, 'saveHTML'
         25        DO_FCALL                                      0  $16     
         26        ECHO                                                     $16
         27      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.43 ms | 1395 KiB | 13 Q