3v4l.org

run code in 300+ PHP versions simultaneously
<?php $imageTag = '<description><![CDATA[<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"> <title>castle</title> </head> <body> <br> <br> <img src="http://nycxplorer.com/wp-content/uploads/2012/02/bagel1-1.jpg" > <br><br>a;lkj>poique <br> A Castle! </body> </html>]]></description>'; //grab the src portion of the image tag $srcPattern = "/src\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/tANAS
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, '%3Cdescription%3E%3C%21%5BCDATA%5B%3C%21DOCTYPE+html+PUBLIC+%22-%2F%2FW3C%2F%2FDTD+HTML+4.01+Transitional%2F%2FEN%22%3E%0A%3Chtml%3E%0A%3Chead%3E%0A++%3Cmeta%0A+content%3D%22text%2Fhtml%3B+charset%3DISO-8859-1%22%0A+http-equiv%3D%22content-type%22%3E%0A++%3Ctitle%3Ecastle%3C%2Ftitle%3E%0A%3C%2Fhead%3E%0A%3Cbody%3E%0A%3Cbr%3E%0A%3Cbr%3E%0A%3Cimg+src%3D%22http%3A%2F%2Fnycxplorer.com%2Fwp-content%2Fuploads%2F2012%2F02%2Fbagel1-1.jpg%22++%3E++%3Cbr%3E%3Cbr%3Ea%3Blkj%3Epoique%0A%3Cbr%3E%0AA+Castle%21%0A%3C%2Fbody%3E%0A%3C%2Fhtml%3E%5D%5D%3E%3C%2Fdescription%3E'
   20     1        ASSIGN                                                   !1, '%2Fsrc%5Cs%2A%3F%3D%5Cs%2A%3F%5CS%2B%3E%2Fs'
   21     2        INIT_FCALL                                               'preg_match'
          3        SEND_VAR                                                 !1
          4        SEND_VAR                                                 !0
          5        SEND_REF                                                 !2
          6        DO_ICALL                                                 
   22     7        FETCH_DIM_R                                      ~8      !2, 0
          8        ASSIGN                                                   !3, ~8
   23     9        INIT_FCALL                                               'print_r'
         10        CONCAT                                           ~10     !3, '%0A'
         11        SEND_VAL                                                 ~10
         12        DO_ICALL                                                 
   26    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
   27    22        INIT_FCALL                                               'print_r'
         23        CONCAT                                           ~15     !3, '%0A'
         24        SEND_VAL                                                 ~15
         25        DO_ICALL                                                 
   30    26        INIT_FCALL                                               'substr'
         27        SEND_VAR                                                 !3
         28        SEND_VAL                                                 4
         29        DO_ICALL                                         $17     
         30        ASSIGN                                                   !4, $17
   33    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
   34    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
   36    46    >   INIT_FCALL                                               'print_r'
         47        CONCAT                                           ~27     !4, '%0A'
         48        SEND_VAL                                                 ~27
         49        DO_ICALL                                                 
   37    50      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.21 ms | 1392 KiB | 23 Q