3v4l.org

run code in 300+ PHP versions simultaneously
<?php $imageTag = '<img src = http://nycxplorer.com/wp-content/uploads/2012/02/bagel1-1.jpg >'; //remove all whitespace from within and around the src portion $imageTag = trim(preg_replace('/[\s]+/','', $imageTag)); print_r($imageTag . "\n"); //grab the src portion of the image tag $srcPattern = "/src.*?=.*?(\s|>)/s"; preg_match($srcPattern, $imageTag, $srcParts); $srcPart = $srcParts[0]; 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(strpos($oldUrl, '"') == 0 || strpos($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 = 37, Position 2 = 43
Branch analysis from position: 37
2 jumps found. (Code = 43) Position 1 = 44, Position 2 = 52
Branch analysis from position: 44
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 52
Branch analysis from position: 43
filename:       /in/LNqut
function name:  (null)
number of ops:  57
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+++++http%3A%2F%2Fnycxplorer.com%2Fwp-content%2Fuploads%2F2012%2F02%2Fbagel1-1.jpg++++%3E'
    5     1        INIT_FCALL                                               'trim'
          2        INIT_FCALL                                               'preg_replace'
          3        SEND_VAL                                                 '%2F%5B%5Cs%5D%2B%2F'
          4        SEND_VAL                                                 ''
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $6      
          7        SEND_VAR                                                 $6
          8        DO_ICALL                                         $7      
          9        ASSIGN                                                   !0, $7
    6    10        INIT_FCALL                                               'print_r'
         11        CONCAT                                           ~9      !0, '%0A'
         12        SEND_VAL                                                 ~9
         13        DO_ICALL                                                 
    9    14        ASSIGN                                                   !1, '%2Fsrc.%2A%3F%3D.%2A%3F%28%5Cs%7C%3E%29%2Fs'
   10    15        INIT_FCALL                                               'preg_match'
         16        SEND_VAR                                                 !1
         17        SEND_VAR                                                 !0
         18        SEND_REF                                                 !2
         19        DO_ICALL                                                 
   11    20        FETCH_DIM_R                                      ~13     !2, 0
         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        INIT_FCALL                                               'strpos'
         32        SEND_VAR                                                 !4
         33        SEND_VAL                                                 '%22'
         34        DO_ICALL                                         $19     
         35        IS_EQUAL                                         ~20     $19, 0
         36      > JMPNZ_EX                                         ~20     ~20, ->43
         37    >   INIT_FCALL                                               'strpos'
         38        SEND_VAR                                                 !4
         39        SEND_VAL                                                 '%27'
         40        DO_ICALL                                         $21     
         41        IS_EQUAL                                         ~22     $21, 0
         42        BOOL                                             ~20     ~22
         43    > > JMPZ                                                     ~20, ->52
   19    44    >   INIT_FCALL                                               'substr'
         45        SEND_VAR                                                 !4
         46        SEND_VAL                                                 1
         47        STRLEN                                           ~23     !4
         48        SUB                                              ~24     ~23, 2
         49        SEND_VAL                                                 ~24
         50        DO_ICALL                                         $25     
         51        ASSIGN                                                   !4, $25
   21    52    >   INIT_FCALL                                               'print_r'
         53        CONCAT                                           ~27     !4, '%0A'
         54        SEND_VAL                                                 ~27
         55        DO_ICALL                                                 
   22    56      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.31 ms | 1392 KiB | 25 Q