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">'; //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*?\S+(\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 = 24, Position 2 = 30
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 39
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
Branch analysis from position: 30
filename:       /in/3QQIu
function name:  (null)
number of ops:  44
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++++height%3D%22300%22++width%3D%22200%22%3E'
    9     1        ASSIGN                                                   !1, '%2Fsrc%5Cs%2A%3F%3D%5Cs%2A%3F%5CS%2B%28%5Cs%7C%3E%29%2Fs'
   10     2        INIT_FCALL                                               'preg_match'
          3        SEND_VAR                                                 !1
          4        SEND_VAR                                                 !0
          5        SEND_REF                                                 !2
          6        DO_ICALL                                                 
   11     7        FETCH_DIM_R                                      ~8      !2, 0
          8        ASSIGN                                                   !3, ~8
   12     9        INIT_FCALL                                               'print_r'
         10        CONCAT                                           ~10     !3, '%0A'
         11        SEND_VAL                                                 ~10
         12        DO_ICALL                                                 
   15    13        INIT_FCALL                                               'substr'
         14        SEND_VAR                                                 !3
         15        SEND_VAL                                                 4
         16        DO_ICALL                                         $12     
         17        ASSIGN                                                   !4, $12
   18    18        INIT_FCALL                                               'strpos'
         19        SEND_VAR                                                 !4
         20        SEND_VAL                                                 '%22'
         21        DO_ICALL                                         $14     
         22        IS_EQUAL                                         ~15     $14, 0
         23      > JMPNZ_EX                                         ~15     ~15, ->30
         24    >   INIT_FCALL                                               'strpos'
         25        SEND_VAR                                                 !4
         26        SEND_VAL                                                 '%27'
         27        DO_ICALL                                         $16     
         28        IS_EQUAL                                         ~17     $16, 0
         29        BOOL                                             ~15     ~17
         30    > > JMPZ                                                     ~15, ->39
   19    31    >   INIT_FCALL                                               'substr'
         32        SEND_VAR                                                 !4
         33        SEND_VAL                                                 1
         34        STRLEN                                           ~18     !4
         35        SUB                                              ~19     ~18, 2
         36        SEND_VAL                                                 ~19
         37        DO_ICALL                                         $20     
         38        ASSIGN                                                   !4, $20
   21    39    >   INIT_FCALL                                               'print_r'
         40        CONCAT                                           ~22     !4, '%0A'
         41        SEND_VAL                                                 ~22
         42        DO_ICALL                                                 
   22    43      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.53 ms | 1392 KiB | 21 Q