3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<HTML <div> <img src="icons/example.svg"> <a href="http://www.example.com">a link</a> <link href="css/example.css"> <iframe src="http://www.example.com/default.htm"></iframe> </div> HTML; $doc = new DOMDocument(); $doc->loadHTML($html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); $doc->substituteEntities = false; $xpath = new DOMXPath($doc); foreach ($xpath->query('//img/@src | //link/@href') as $attr) { $attr->value = "{{asset('" . $attr->value . ")'}}"; } echo $doc->saveHTML();
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 18, Position 2 = 25
Branch analysis from position: 18
2 jumps found. (Code = 78) Position 1 = 19, Position 2 = 25
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
filename:       /in/9tErG
function name:  (null)
number of ops:  30
compiled vars:  !0 = $html, !1 = $doc, !2 = $xpath, !3 = $attr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%3Cdiv%3E%0A++++%3Cimg+src%3D%22icons%2Fexample.svg%22%3E%0A++++%3Ca+href%3D%22http%3A%2F%2Fwww.example.com%22%3Ea+link%3C%2Fa%3E%0A++++%3Clink+href%3D%22css%2Fexample.css%22%3E%0A++++%3Ciframe+src%3D%22http%3A%2F%2Fwww.example.com%2Fdefault.htm%22%3E%3C%2Fiframe%3E%0A%3C%2Fdiv%3E'
   11     1        NEW                                              $5      'DOMDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $5
   12     4        INIT_METHOD_CALL                                         !1, 'loadHTML'
          5        SEND_VAR_EX                                              !0
          6        SEND_VAL_EX                                              8196
          7        DO_FCALL                                      0          
   13     8        ASSIGN_OBJ                                               !1, 'substituteEntities'
          9        OP_DATA                                                  <false>
   14    10        NEW                                              $10     'DOMXPath'
         11        SEND_VAR_EX                                              !1
         12        DO_FCALL                                      0          
         13        ASSIGN                                                   !2, $10
   15    14        INIT_METHOD_CALL                                         !2, 'query'
         15        SEND_VAL_EX                                              '%2F%2Fimg%2F%40src+%7C+%2F%2Flink%2F%40href'
         16        DO_FCALL                                      0  $13     
         17      > FE_RESET_R                                       $14     $13, ->25
         18    > > FE_FETCH_R                                               $14, !3, ->25
   16    19    >   FETCH_OBJ_R                                      ~16     !3, 'value'
         20        CONCAT                                           ~17     '%7B%7Basset%28%27', ~16
         21        CONCAT                                           ~18     ~17, '%29%27%7D%7D'
         22        ASSIGN_OBJ                                               !3, 'value'
         23        OP_DATA                                                  ~18
   15    24      > JMP                                                      ->18
         25    >   FE_FREE                                                  $14
   18    26        INIT_METHOD_CALL                                         !1, 'saveHTML'
         27        DO_FCALL                                      0  $19     
         28        ECHO                                                     $19
         29      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.86 ms | 1395 KiB | 13 Q