3v4l.org

run code in 300+ PHP versions simultaneously
<?php $imageTag = '<img src = "http://nycxplorer.com/wp-content/uploads/2012/02/bagel1-1.jpg" height="300" width="200">'; //grab the src portion of the image tag $srcPattern = "/src\s*?=\s*?\S+(\s|>)/s"; preg_match($srcPattern, $imageTag, $srcParts); $srcPart = $srcParts[0]; print_r($srcPart. "\n"); //remove all whitespace from within and around the src portion $srcPart = trim(preg_replace('/[\s]+/','', $srcPart)); print_r($srcPart . "\n"); //grab the src URL $oldUrl = substr($srcPart, 4); //if there are quotes at the beginning of the url, cut them off if($oldUrl[0] == '"' || $oldUrl[0] == "'") { $oldUrl = substr($oldUrl, 1, strlen($oldUrl)-2); } print_r($oldUrl. "\n"); ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 34, Position 2 = 37
Branch analysis from position: 34
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 46
Branch analysis from position: 38
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 46
Branch analysis from position: 37
filename:       /in/brqfp
function name:  (null)
number of ops:  51
compiled vars:  !0 = $imageTag, !1 = $srcPattern, !2 = $srcParts, !3 = $srcPart, !4 = $oldUrl
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%3Cimg+src+++++%3D+++++%22http%3A%2F%2Fnycxplorer.com%2Fwp-content%2Fuploads%2F2012%2F02%2Fbagel1-1.jpg%22++++height%3D%22300%22++width%3D%22200%22%3E'
    5     1        ASSIGN                                                   !1, '%2Fsrc%5Cs%2A%3F%3D%5Cs%2A%3F%5CS%2B%28%5Cs%7C%3E%29%2Fs'
    6     2        INIT_FCALL                                               'preg_match'
          3        SEND_VAR                                                 !1
          4        SEND_VAR                                                 !0
          5        SEND_REF                                                 !2
          6        DO_ICALL                                                 
    7     7        FETCH_DIM_R                                      ~8      !2, 0
          8        ASSIGN                                                   !3, ~8
    8     9        INIT_FCALL                                               'print_r'
         10        CONCAT                                           ~10     !3, '%0A'
         11        SEND_VAL                                                 ~10
         12        DO_ICALL                                                 
   11    13        INIT_FCALL                                               'trim'
         14        INIT_FCALL                                               'preg_replace'
         15        SEND_VAL                                                 '%2F%5B%5Cs%5D%2B%2F'
         16        SEND_VAL                                                 ''
         17        SEND_VAR                                                 !3
         18        DO_ICALL                                         $12     
         19        SEND_VAR                                                 $12
         20        DO_ICALL                                         $13     
         21        ASSIGN                                                   !3, $13
   12    22        INIT_FCALL                                               'print_r'
         23        CONCAT                                           ~15     !3, '%0A'
         24        SEND_VAL                                                 ~15
         25        DO_ICALL                                                 
   15    26        INIT_FCALL                                               'substr'
         27        SEND_VAR                                                 !3
         28        SEND_VAL                                                 4
         29        DO_ICALL                                         $17     
         30        ASSIGN                                                   !4, $17
   18    31        FETCH_DIM_R                                      ~19     !4, 0
         32        IS_EQUAL                                         ~20     ~19, '%22'
         33      > JMPNZ_EX                                         ~20     ~20, ->37
         34    >   FETCH_DIM_R                                      ~21     !4, 0
         35        IS_EQUAL                                         ~22     ~21, '%27'
         36        BOOL                                             ~20     ~22
         37    > > JMPZ                                                     ~20, ->46
   19    38    >   INIT_FCALL                                               'substr'
         39        SEND_VAR                                                 !4
         40        SEND_VAL                                                 1
         41        STRLEN                                           ~23     !4
         42        SUB                                              ~24     ~23, 2
         43        SEND_VAL                                                 ~24
         44        DO_ICALL                                         $25     
         45        ASSIGN                                                   !4, $25
   21    46    >   INIT_FCALL                                               'print_r'
         47        CONCAT                                           ~27     !4, '%0A'
         48        SEND_VAL                                                 ~27
         49        DO_ICALL                                                 
   22    50      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.16 ms | 1392 KiB | 23 Q