3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.37 ms | 1400 KiB | 25 Q