3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = '<p height="200px;"> <img alt="Fahrrad Alt-Tag" src="http://localhost/mediafiles/Bilder/diamant-e-bike.jpg" height="250px" style="float: left; width: 300px; height: 189px; margin-left: 10px; margin-right: 10px;"> <br> <div style="height:200px;"> <img alt="Fahrrad Alt-Tag" src="http://localhost/mediafiles/Bilder/diamant-e-bike.jpg" height="250px" style="float: left; width: 300px; height: 189px; margin-left: 10px; margin-right: 10px;" class="google"> </div>'; function e24_img_responsive($html) { /* preg_match_all("~<img\s*(?:style\s*\=\s*[\'\"](.*?)[\'\"].*?\s*|class\s*\=\s*[\'\"](.*?)[\'\"].*?\s*|src\s*\=\s*[\'\"](.*?)[\'\"].*?\s*|alt\s*\=\s*[\'\"](.*?)[\'\"].*?\s*|width\s*\=\s*[\'\"](.*?)[\'\"].*?\s*|height\s*\=\s*[\'\"](.*?)[\'\"].*?\s*)+.*?>~", $html, $aImageTags); foreach($aImageTags[0] as $index => $string) { $new_string = $string; // style tag found if(!empty($aImageTags[1][$index])) { $new_string = preg_replace("~height:.*;~") } // class tag found if(!empty($aImageTags[2][$index])) { var_dump($aImageTags[2][$index]); } // height tag found if(!empty($aImageTags[6][$index])) { var_dump($aImageTags[6][$index]); } } */ $dom = new DOMDocument(); $dom->loadHTML($html); $images = $dom->getElementsByTagName('img'); while($img = $images->item($i++)) { foreach($img->attributes as $attr) { echo $attr->name . " " . $attr->value . "<br />"; } } } e24_img_responsive($str); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RoICZ
function name:  (null)
number of ops:  5
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3Cp+height%3D%22200px%3B%22%3E%0A%0A%3Cimg+alt%3D%22Fahrrad+Alt-Tag%22+src%3D%22http%3A%2F%2Flocalhost%2Fmediafiles%2FBilder%2Fdiamant-e-bike.jpg%22++height%3D%22250px%22+style%3D%22float%3A+left%3B+width%3A+300px%3B+height%3A+189px%3B++margin-left%3A+10px%3B+margin-right%3A+10px%3B%22%3E%0A%3Cbr%3E%0A%3Cdiv+style%3D%22height%3A200px%3B%22%3E%0A%3Cimg+alt%3D%22Fahrrad+Alt-Tag%22+src%3D%22http%3A%2F%2Flocalhost%2Fmediafiles%2FBilder%2Fdiamant-e-bike.jpg%22++height%3D%22250px%22+style%3D%22float%3A+left%3B+width%3A+300px%3B+height%3A+189px%3B++margin-left%3A+10px%3B+margin-right%3A+10px%3B%22+class%3D%22google%22%3E%0A%3C%2Fdiv%3E'
   47     1        INIT_FCALL                                               'e24_img_responsive'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0          
   50     4      > RETURN                                                   1

Function e24_img_responsive:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 12
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 22
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 22
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 12
Branch analysis from position: 29
Branch analysis from position: 12
Branch analysis from position: 22
filename:       /in/RoICZ
function name:  e24_img_responsive
number of ops:  30
compiled vars:  !0 = $html, !1 = $dom, !2 = $images, !3 = $img, !4 = $attr, !5 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   34     1        NEW                                              $6      'DOMDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $6
   35     4        INIT_METHOD_CALL                                         !1, 'loadHTML'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
   36     7        INIT_METHOD_CALL                                         !1, 'getElementsByTagName'
          8        SEND_VAL_EX                                              'img'
          9        DO_FCALL                                      0  $10     
         10        ASSIGN                                                   !2, $10
   38    11      > JMP                                                      ->23
   40    12    >   FETCH_OBJ_R                                      ~12     !3, 'attributes'
         13      > FE_RESET_R                                       $13     ~12, ->22
         14    > > FE_FETCH_R                                               $13, !4, ->22
   42    15    >   FETCH_OBJ_R                                      ~14     !4, 'name'
         16        CONCAT                                           ~15     ~14, '+'
         17        FETCH_OBJ_R                                      ~16     !4, 'value'
         18        CONCAT                                           ~17     ~15, ~16
         19        CONCAT                                           ~18     ~17, '%3Cbr+%2F%3E'
         20        ECHO                                                     ~18
   40    21      > JMP                                                      ->14
         22    >   FE_FREE                                                  $13
   38    23    >   INIT_METHOD_CALL                                         !2, 'item'
         24        POST_INC                                         ~19     !5
         25        SEND_VAL_EX                                              ~19
         26        DO_FCALL                                      0  $20     
         27        ASSIGN                                           ~21     !3, $20
         28      > JMPNZ                                                    ~21, ->12
   45    29    > > RETURN                                                   null

End of function e24_img_responsive

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
183.23 ms | 1407 KiB | 14 Q