3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = <<<HTML This is some sample data which is going to contain an image in the format <img src="http://www.randomdomain.com/randomfolder/randomimagename.jpg">. It will also contain lots of other text and maybe another image or two like this: <img alt='another image' src='http://www.example.com/randomfolder/randomimagename.jpg'> HTML; $srcs = []; $dom=new DOMDocument; $dom->loadHTML($string); foreach ($dom->getElementsByTagName('img') as $img) { $srcs[] = $img->getAttribute('src'); } var_export($srcs);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 19
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 19
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/bb3O6
function name:  (null)
number of ops:  24
compiled vars:  !0 = $string, !1 = $srcs, !2 = $dom, !3 = $img
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'This+is+some+sample+data+which+is+going+to+contain+an+image+in+the+format+%3Cimg+src%3D%22http%3A%2F%2Fwww.randomdomain.com%2Frandomfolder%2Frandomimagename.jpg%22%3E.++It+will+also+contain+lots+of+other+text+and+maybe+another+image+or+two+like+this%3A+%3Cimg+alt%3D%27another+image%27+src%3D%27http%3A%2F%2Fwww.example.com%2Frandomfolder%2Frandomimagename.jpg%27%3E'
    6     1        ASSIGN                                                   !1, <array>
    7     2        NEW                                              $6      'DOMDocument'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !2, $6
    8     5        INIT_METHOD_CALL                                         !2, 'loadHTML'
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0          
    9     8        INIT_METHOD_CALL                                         !2, 'getElementsByTagName'
          9        SEND_VAL_EX                                              'img'
         10        DO_FCALL                                      0  $10     
         11      > FE_RESET_R                                       $11     $10, ->19
         12    > > FE_FETCH_R                                               $11, !3, ->19
   10    13    >   INIT_METHOD_CALL                                         !3, 'getAttribute'
         14        SEND_VAL_EX                                              'src'
         15        DO_FCALL                                      0  $13     
         16        ASSIGN_DIM                                               !1
         17        OP_DATA                                                  $13
    9    18      > JMP                                                      ->12
         19    >   FE_FREE                                                  $11
   13    20        INIT_FCALL                                               'var_export'
         21        SEND_VAR                                                 !1
         22        DO_ICALL                                                 
         23      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.33 ms | 999 KiB | 14 Q