3v4l.org

run code in 300+ PHP versions simultaneously
<?php $bigKml = "<Document><name>test2.kmz</name><br><img src='files/bagel.png'><br><br></Document>"; $titleTagPattern = '/<Document><name>.*?<\/name>/'; preg_match($titleTagPattern, $bigKml, $titleTags); $titleTag = $titleTags[0]; $titlePattern = "/>.*?.kmz/"; preg_match($titlePattern, $bigKml, $titles); $title = $titles[0]; print_r($title); $imgPattern = "/<img src=.*?>/"; preg_match($imgPattern, $bigKml, $imageTags); print_r($imageTags); foreach($imageTags as $imageTag) { $urlPattern = "/'([^']*)'/"; preg_match($urlPattern, $imageTag, $oldUrls); $oldUrl = $oldUrls[1]; //the second element contains the match without the quotes print_r($oldUrl . "\n"); $newUrl = "/var/www/resources/" . $oldUrl; print_r($newUrl . "\n"); } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 30, Position 2 = 50
Branch analysis from position: 30
2 jumps found. (Code = 78) Position 1 = 31, Position 2 = 50
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
Branch analysis from position: 50
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 50
filename:       /in/Pf4Gj
function name:  (null)
number of ops:  52
compiled vars:  !0 = $bigKml, !1 = $titleTagPattern, !2 = $titleTags, !3 = $titleTag, !4 = $titlePattern, !5 = $titles, !6 = $title, !7 = $imgPattern, !8 = $imageTags, !9 = $imageTag, !10 = $urlPattern, !11 = $oldUrls, !12 = $oldUrl, !13 = $newUrl
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%3CDocument%3E%3Cname%3Etest2.kmz%3C%2Fname%3E%3Cbr%3E%3Cimg+src%3D%27files%2Fbagel.png%27%3E%3Cbr%3E%3Cbr%3E%3C%2FDocument%3E'
    4     1        ASSIGN                                                   !1, '%2F%3CDocument%3E%3Cname%3E.%2A%3F%3C%5C%2Fname%3E%2F'
    5     2        INIT_FCALL                                               'preg_match'
          3        SEND_VAR                                                 !1
          4        SEND_VAR                                                 !0
          5        SEND_REF                                                 !2
          6        DO_ICALL                                                 
    6     7        FETCH_DIM_R                                      ~17     !2, 0
          8        ASSIGN                                                   !3, ~17
    7     9        ASSIGN                                                   !4, '%2F%3E.%2A%3F.kmz%2F'
    8    10        INIT_FCALL                                               'preg_match'
         11        SEND_VAR                                                 !4
         12        SEND_VAR                                                 !0
         13        SEND_REF                                                 !5
         14        DO_ICALL                                                 
    9    15        FETCH_DIM_R                                      ~21     !5, 0
         16        ASSIGN                                                   !6, ~21
   10    17        INIT_FCALL                                               'print_r'
         18        SEND_VAR                                                 !6
         19        DO_ICALL                                                 
   12    20        ASSIGN                                                   !7, '%2F%3Cimg+src%3D.%2A%3F%3E%2F'
   13    21        INIT_FCALL                                               'preg_match'
         22        SEND_VAR                                                 !7
         23        SEND_VAR                                                 !0
         24        SEND_REF                                                 !8
         25        DO_ICALL                                                 
   14    26        INIT_FCALL                                               'print_r'
         27        SEND_VAR                                                 !8
         28        DO_ICALL                                                 
   16    29      > FE_RESET_R                                       $27     !8, ->50
         30    > > FE_FETCH_R                                               $27, !9, ->50
   17    31    >   ASSIGN                                                   !10, '%2F%27%28%5B%5E%27%5D%2A%29%27%2F'
   18    32        INIT_FCALL                                               'preg_match'
         33        SEND_VAR                                                 !10
         34        SEND_VAR                                                 !9
         35        SEND_REF                                                 !11
         36        DO_ICALL                                                 
   19    37        FETCH_DIM_R                                      ~30     !11, 1
         38        ASSIGN                                                   !12, ~30
   20    39        INIT_FCALL                                               'print_r'
         40        CONCAT                                           ~32     !12, '%0A'
         41        SEND_VAL                                                 ~32
         42        DO_ICALL                                                 
   21    43        CONCAT                                           ~34     '%2Fvar%2Fwww%2Fresources%2F', !12
         44        ASSIGN                                                   !13, ~34
   22    45        INIT_FCALL                                               'print_r'
         46        CONCAT                                           ~36     !13, '%0A'
         47        SEND_VAL                                                 ~36
         48        DO_ICALL                                                 
   16    49      > JMP                                                      ->30
         50    >   FE_FREE                                                  $27
   24    51      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.79 ms | 1400 KiB | 17 Q