3v4l.org

run code in 500+ PHP versions simultaneously
<?php $body = '... Cras ut tristique est. Etiam porttitor elit velit, vitae consequat eros interdum ac. Nam in blandit ante.</p><p>&nbsp;</p><figure class="image"><img src="/storage/5/articles/pictures/1560534410321_a363bc0d804aec432567128ed10416ee.jpeg"></figure><p>Integer sed justo accumsan, consequat nulla at, tincidunt massa. Integer orna Etiam porttitor elit velit, vitae consequat eros interdum ac. Nam in blandit ante.</p><p>&nbsp;</p><figure class="image"><img src="/storage/5/articles/pictures/23456410321_a33456t604aec432567128ed10416ee.jpeg"></figure> j hgfjhf jfhfj hgf jh786 876 8 76fgj tfyt u ufgi uyu y gi iy gygg ...'; $dom = new DOMDocument(); @$dom->loadHtml($body, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); $xpath = new DOMXPath($dom); $imgs = []; foreach ($xpath->query("//figure/img") as $img) { $src = $img->getAttribute('src'); if (preg_match('#/storage/(.*)/articles/pictures/(.*)#', $src, $result)) { $imgs[] = [ 'id' => $result[1], 'name' => $result[2] ]; } } print_r($imgs);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 19, Position 2 = 37
Branch analysis from position: 19
2 jumps found. (Code = 78) Position 1 = 20, Position 2 = 37
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 36
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
Branch analysis from position: 36
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
filename:       /in/61hDi
function name:  (null)
number of ops:  42
compiled vars:  !0 = $body, !1 = $dom, !2 = $xpath, !3 = $imgs, !4 = $img, !5 = $src, !6 = $result
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, '...+Cras+ut+tristique+est.+Etiam+porttitor+elit+velit%2C+vitae+consequat+eros+interdum+ac.+Nam+in+blandit+ante.%3C%2Fp%3E%3Cp%3E%26nbsp%3B%3C%2Fp%3E%3Cfigure+class%3D%22image%22%3E%3Cimg+src%3D%22%2Fstorage%2F5%2Farticles%2Fpictures%2F1560534410321_a363bc0d804aec432567128ed10416ee.jpeg%22%3E%3C%2Ffigure%3E%3Cp%3EInteger+sed+justo+accumsan%2C+consequat+nulla+at%2C+tincidunt+massa.+Integer+orna+Etiam+porttitor+elit+velit%2C+vitae+consequat+eros+interdum+ac.+Nam+in+blandit+ante.%3C%2Fp%3E%3Cp%3E%26nbsp%3B%3C%2Fp%3E%3Cfigure+class%3D%22image%22%3E%3Cimg+src%3D%22%2Fstorage%2F5%2Farticles%2Fpictures%2F23456410321_a33456t604aec432567128ed10416ee.jpeg%22%3E%3C%2Ffigure%3E+j+hgfjhf++jfhfj+hgf+jh786+876+8+76fgj+tfyt+u++ufgi+uyu+y+gi+iy+gygg+...'
    4     1        NEW                                                  $8      'DOMDocument'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !1, $8
    5     4        BEGIN_SILENCE                                        ~11     
          5        INIT_METHOD_CALL                                             !1, 'loadHtml'
          6        SEND_VAR_EX                                                  !0
          7        SEND_VAL_EX                                                  8196
          8        DO_FCALL                                          0          
          9        END_SILENCE                                                  ~11
    7    10        NEW                                                  $13     'DOMXPath'
         11        SEND_VAR_EX                                                  !1
         12        DO_FCALL                                          0          
         13        ASSIGN                                                       !2, $13
    9    14        ASSIGN                                                       !3, <array>
   10    15        INIT_METHOD_CALL                                             !2, 'query'
         16        SEND_VAL_EX                                                  '%2F%2Ffigure%2Fimg'
         17        DO_FCALL                                          0  $17     
         18      > FE_RESET_R                                           $18     $17, ->37
         19    > > FE_FETCH_R                                                   $18, !4, ->37
   11    20    >   INIT_METHOD_CALL                                             !4, 'getAttribute'
         21        SEND_VAL_EX                                                  'src'
         22        DO_FCALL                                          0  $19     
         23        ASSIGN                                                       !5, $19
   13    24        INIT_FCALL                                                   'preg_match'
         25        SEND_VAL                                                     '%23%2Fstorage%2F%28.%2A%29%2Farticles%2Fpictures%2F%28.%2A%29%23'
         26        SEND_VAR                                                     !5
         27        SEND_REF                                                     !6
         28        DO_ICALL                                             $21     
         29      > JMPZ                                                         $21, ->36
   15    30    >   FETCH_DIM_R                                          ~23     !6, 1
         31        INIT_ARRAY                                           ~24     ~23, 'id'
   16    32        FETCH_DIM_R                                          ~25     !6, 2
         33        ADD_ARRAY_ELEMENT                                    ~24     ~25, 'name'
   14    34        ASSIGN_DIM                                                   !3
   16    35        OP_DATA                                                      ~24
   10    36    > > JMP                                                          ->19
         37    >   FE_FREE                                                      $18
   21    38        INIT_FCALL                                                   'print_r'
         39        SEND_VAR                                                     !3
         40        DO_ICALL                                                     
         41      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
208.69 ms | 2339 KiB | 15 Q