3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<HTML <div data-image-id="344231" style="height: 399.333px; background-image: url('/website/view_image/344231/medium'); background-size: contain;"></div> HTML; $doc = new DOMDocument(); $doc->loadHTML($html); $elm = $doc->getElementsByTagName("div"); $result = array (); $style = $doc->getElementsByTagName("div")->item(0)->getAttribute("style"); foreach (explode("; ", $style) as $str) if (preg_match ('/background-image: url\(([^)]+)\)/', $str, $matches)) { $result[] = $matches[1]; } echo $result[0];
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 27, Position 2 = 38
Branch analysis from position: 27
2 jumps found. (Code = 78) Position 1 = 28, Position 2 = 38
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 34, Position 2 = 37
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
Branch analysis from position: 37
Branch analysis from position: 38
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 38
filename:       /in/RgKi0
function name:  (null)
number of ops:  42
compiled vars:  !0 = $html, !1 = $doc, !2 = $elm, !3 = $result, !4 = $style, !5 = $str, !6 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%3Cdiv+data-image-id%3D%22344231%22+style%3D%22height%3A+399.333px%3B+background-image%3A+url%28%27%2Fwebsite%2Fview_image%2F344231%2Fmedium%27%29%3B+background-size%3A+contain%3B%22%3E%3C%2Fdiv%3E'
    5     1        NEW                                              $8      'DOMDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $8
    6     4        INIT_METHOD_CALL                                         !1, 'loadHTML'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
    7     7        INIT_METHOD_CALL                                         !1, 'getElementsByTagName'
          8        SEND_VAL_EX                                              'div'
          9        DO_FCALL                                      0  $12     
         10        ASSIGN                                                   !2, $12
    8    11        ASSIGN                                                   !3, <array>
    9    12        INIT_METHOD_CALL                                         !1, 'getElementsByTagName'
         13        SEND_VAL_EX                                              'div'
         14        DO_FCALL                                      0  $15     
         15        INIT_METHOD_CALL                                         $15, 'item'
         16        SEND_VAL_EX                                              0
         17        DO_FCALL                                      0  $16     
         18        INIT_METHOD_CALL                                         $16, 'getAttribute'
         19        SEND_VAL_EX                                              'style'
         20        DO_FCALL                                      0  $17     
         21        ASSIGN                                                   !4, $17
   10    22        INIT_FCALL                                               'explode'
         23        SEND_VAL                                                 '%3B+'
         24        SEND_VAR                                                 !4
         25        DO_ICALL                                         $19     
         26      > FE_RESET_R                                       $20     $19, ->38
         27    > > FE_FETCH_R                                               $20, !5, ->38
   11    28    >   INIT_FCALL                                               'preg_match'
         29        SEND_VAL                                                 '%2Fbackground-image%3A+url%5C%28%28%5B%5E%29%5D%2B%29%5C%29%2F'
         30        SEND_VAR                                                 !5
         31        SEND_REF                                                 !6
         32        DO_ICALL                                         $21     
         33      > JMPZ                                                     $21, ->37
   12    34    >   FETCH_DIM_R                                      ~23     !6, 1
         35        ASSIGN_DIM                                               !3
         36        OP_DATA                                                  ~23
   10    37    > > JMP                                                      ->27
         38    >   FE_FREE                                                  $20
   14    39        FETCH_DIM_R                                      ~24     !3, 0
         40        ECHO                                                     ~24
         41      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.39 ms | 1008 KiB | 15 Q