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]; $len = strlen($titleTag); $title = substr($titleTag, 16, $len - 23); print_r($title . "\n"); $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 = 32, Position 2 = 52
Branch analysis from position: 32
2 jumps found. (Code = 78) Position 1 = 33, Position 2 = 52
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
Branch analysis from position: 52
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 52
filename:       /in/QSqHn
function name:  (null)
number of ops:  54
compiled vars:  !0 = $bigKml, !1 = $titleTagPattern, !2 = $titleTags, !3 = $titleTag, !4 = $len, !5 = $title, !6 = $imgPattern, !7 = $imageTags, !8 = $imageTag, !9 = $urlPattern, !10 = $oldUrls, !11 = $oldUrl, !12 = $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                                      ~16     !2, 0
          8        ASSIGN                                                   !3, ~16
    7     9        STRLEN                                           ~18     !3
         10        ASSIGN                                                   !4, ~18
    8    11        INIT_FCALL                                               'substr'
         12        SEND_VAR                                                 !3
         13        SEND_VAL                                                 16
         14        SUB                                              ~20     !4, 23
         15        SEND_VAL                                                 ~20
         16        DO_ICALL                                         $21     
         17        ASSIGN                                                   !5, $21
    9    18        INIT_FCALL                                               'print_r'
         19        CONCAT                                           ~23     !5, '%0A'
         20        SEND_VAL                                                 ~23
         21        DO_ICALL                                                 
   11    22        ASSIGN                                                   !6, '%2F%3Cimg+src%3D.%2A%3F%3E%2F'
   12    23        INIT_FCALL                                               'preg_match'
         24        SEND_VAR                                                 !6
         25        SEND_VAR                                                 !0
         26        SEND_REF                                                 !7
         27        DO_ICALL                                                 
   13    28        INIT_FCALL                                               'print_r'
         29        SEND_VAR                                                 !7
         30        DO_ICALL                                                 
   15    31      > FE_RESET_R                                       $28     !7, ->52
         32    > > FE_FETCH_R                                               $28, !8, ->52
   16    33    >   ASSIGN                                                   !9, '%2F%27%28%5B%5E%27%5D%2A%29%27%2F'
   17    34        INIT_FCALL                                               'preg_match'
         35        SEND_VAR                                                 !9
         36        SEND_VAR                                                 !8
         37        SEND_REF                                                 !10
         38        DO_ICALL                                                 
   18    39        FETCH_DIM_R                                      ~31     !10, 1
         40        ASSIGN                                                   !11, ~31
   19    41        INIT_FCALL                                               'print_r'
         42        CONCAT                                           ~33     !11, '%0A'
         43        SEND_VAL                                                 ~33
         44        DO_ICALL                                                 
   20    45        CONCAT                                           ~35     '%2Fvar%2Fwww%2Fresources%2F', !11
         46        ASSIGN                                                   !12, ~35
   21    47        INIT_FCALL                                               'print_r'
         48        CONCAT                                           ~37     !12, '%0A'
         49        SEND_VAL                                                 ~37
         50        DO_ICALL                                                 
   15    51      > JMP                                                      ->32
         52    >   FE_FREE                                                  $28
   23    53      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.07 ms | 1400 KiB | 19 Q