3v4l.org

run code in 300+ PHP versions simultaneously
<?php function chiii($url,$href){ if(strstr($href,"#")){ if(substr($href,0,1)=="#")return null; $p=explode('#',$href); $href=$p[0]; } if(substr($url,strlen($url)-1,strlen($url))=='/')$base=$url; else $base=dirname($url); if(substr($href,0,2)=="//"){ $p=parse_url($url); return $p['scheme'].$href; }else if(substr($href,0,1)=="/"){ $p=parse_url($url); return $p['scheme']."//".$p['host'].$href; }else if(preg_match('/^https*\:\/\//',$href))return $href; else if(substr($href,0,3)=="../"){ $pat="/^\.\.\//"; echo "back"; while(preg_match($pat,$href)){ $href=preg_replace($pat,'',$href); $base=dirname($base); } return $base."/".$href; }else if(preg_match("/[a-z]+\:/",$href))return null; else return $base.$href; return "NONE"; } $url="http://netor.ir/hello/wel/"; echo chiii($url,"../client#hello"); echo chiii($url,"client/256/"); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oWn4g
function name:  (null)
number of ops:  12
compiled vars:  !0 = $url
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   ASSIGN                                                   !0, 'http%3A%2F%2Fnetor.ir%2Fhello%2Fwel%2F'
   31     1        INIT_FCALL                                               'chiii'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 '..%2Fclient%23hello'
          4        DO_FCALL                                      0  $2      
          5        ECHO                                                     $2
   32     6        INIT_FCALL                                               'chiii'
          7        SEND_VAR                                                 !0
          8        SEND_VAL                                                 'client%2F256%2F'
          9        DO_FCALL                                      0  $3      
         10        ECHO                                                     $3
   33    11      > RETURN                                                   1

Function chiii:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 22
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 15
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 34
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
2 jumps found. (Code = 43) Position 1 = 45, Position 2 = 53
Branch analysis from position: 45
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 53
2 jumps found. (Code = 43) Position 1 = 60, Position 2 = 71
Branch analysis from position: 60
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 71
2 jumps found. (Code = 43) Position 1 = 76, Position 2 = 78
Branch analysis from position: 76
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 78
2 jumps found. (Code = 43) Position 1 = 85, Position 2 = 107
Branch analysis from position: 85
1 jumps found. (Code = 42) Position 1 = 98
Branch analysis from position: 98
2 jumps found. (Code = 44) Position 1 = 103, Position 2 = 88
Branch analysis from position: 103
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 88
2 jumps found. (Code = 44) Position 1 = 103, Position 2 = 88
Branch analysis from position: 103
Branch analysis from position: 88
Branch analysis from position: 107
2 jumps found. (Code = 43) Position 1 = 112, Position 2 = 114
Branch analysis from position: 112
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 114
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
2 jumps found. (Code = 43) Position 1 = 45, Position 2 = 53
Branch analysis from position: 45
Branch analysis from position: 53
Branch analysis from position: 22
filename:       /in/oWn4g
function name:  chiii
number of ops:  118
compiled vars:  !0 = $url, !1 = $href, !2 = $p, !3 = $base, !4 = $pat
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    3     2        INIT_FCALL                                               'strstr'
          3        SEND_VAR                                                 !1
          4        SEND_VAL                                                 '%23'
          5        DO_ICALL                                         $5      
          6      > JMPZ                                                     $5, ->22
    4     7    >   INIT_FCALL                                               'substr'
          8        SEND_VAR                                                 !1
          9        SEND_VAL                                                 0
         10        SEND_VAL                                                 1
         11        DO_ICALL                                         $6      
         12        IS_EQUAL                                                 $6, '%23'
         13      > JMPZ                                                     ~7, ->15
         14    > > RETURN                                                   null
    5    15    >   INIT_FCALL                                               'explode'
         16        SEND_VAL                                                 '%23'
         17        SEND_VAR                                                 !1
         18        DO_ICALL                                         $8      
         19        ASSIGN                                                   !2, $8
    6    20        FETCH_DIM_R                                      ~10     !2, 0
         21        ASSIGN                                                   !1, ~10
    8    22    >   INIT_FCALL                                               'substr'
         23        SEND_VAR                                                 !0
         24        STRLEN                                           ~12     !0
         25        SUB                                              ~13     ~12, 1
         26        SEND_VAL                                                 ~13
         27        STRLEN                                           ~14     !0
         28        SEND_VAL                                                 ~14
         29        DO_ICALL                                         $15     
         30        IS_EQUAL                                                 $15, '%2F'
         31      > JMPZ                                                     ~16, ->34
         32    >   ASSIGN                                                   !3, !0
         33      > JMP                                                      ->38
    9    34    >   INIT_FCALL                                               'dirname'
         35        SEND_VAR                                                 !0
         36        DO_ICALL                                         $18     
         37        ASSIGN                                                   !3, $18
   10    38    >   INIT_FCALL                                               'substr'
         39        SEND_VAR                                                 !1
         40        SEND_VAL                                                 0
         41        SEND_VAL                                                 2
         42        DO_ICALL                                         $20     
         43        IS_EQUAL                                                 $20, '%2F%2F'
         44      > JMPZ                                                     ~21, ->53
   11    45    >   INIT_FCALL                                               'parse_url'
         46        SEND_VAR                                                 !0
         47        DO_ICALL                                         $22     
         48        ASSIGN                                                   !2, $22
   12    49        FETCH_DIM_R                                      ~24     !2, 'scheme'
         50        CONCAT                                           ~25     ~24, !1
         51      > RETURN                                                   ~25
         52*       JMP                                                      ->116
   13    53    >   INIT_FCALL                                               'substr'
         54        SEND_VAR                                                 !1
         55        SEND_VAL                                                 0
         56        SEND_VAL                                                 1
         57        DO_ICALL                                         $26     
         58        IS_EQUAL                                                 $26, '%2F'
         59      > JMPZ                                                     ~27, ->71
   14    60    >   INIT_FCALL                                               'parse_url'
         61        SEND_VAR                                                 !0
         62        DO_ICALL                                         $28     
         63        ASSIGN                                                   !2, $28
   15    64        FETCH_DIM_R                                      ~30     !2, 'scheme'
         65        CONCAT                                           ~31     ~30, '%2F%2F'
         66        FETCH_DIM_R                                      ~32     !2, 'host'
         67        CONCAT                                           ~33     ~31, ~32
         68        CONCAT                                           ~34     ~33, !1
         69      > RETURN                                                   ~34
         70*       JMP                                                      ->116
   16    71    >   INIT_FCALL                                               'preg_match'
         72        SEND_VAL                                                 '%2F%5Ehttps%2A%5C%3A%5C%2F%5C%2F%2F'
         73        SEND_VAR                                                 !1
         74        DO_ICALL                                         $35     
         75      > JMPZ                                                     $35, ->78
         76    > > RETURN                                                   !1
         77*       JMP                                                      ->116
   17    78    >   INIT_FCALL                                               'substr'
         79        SEND_VAR                                                 !1
         80        SEND_VAL                                                 0
         81        SEND_VAL                                                 3
         82        DO_ICALL                                         $36     
         83        IS_EQUAL                                                 $36, '..%2F'
         84      > JMPZ                                                     ~37, ->107
   18    85    >   ASSIGN                                                   !4, '%2F%5E%5C.%5C.%5C%2F%2F'
   19    86        ECHO                                                     'back'
   20    87      > JMP                                                      ->98
   21    88    >   INIT_FCALL                                               'preg_replace'
         89        SEND_VAR                                                 !4
         90        SEND_VAL                                                 ''
         91        SEND_VAR                                                 !1
         92        DO_ICALL                                         $39     
         93        ASSIGN                                                   !1, $39
   22    94        INIT_FCALL                                               'dirname'
         95        SEND_VAR                                                 !3
         96        DO_ICALL                                         $41     
         97        ASSIGN                                                   !3, $41
   20    98    >   INIT_FCALL                                               'preg_match'
         99        SEND_VAR                                                 !4
        100        SEND_VAR                                                 !1
        101        DO_ICALL                                         $43     
        102      > JMPNZ                                                    $43, ->88
   24   103    >   CONCAT                                           ~44     !3, '%2F'
        104        CONCAT                                           ~45     ~44, !1
        105      > RETURN                                                   ~45
        106*       JMP                                                      ->116
   25   107    >   INIT_FCALL                                               'preg_match'
        108        SEND_VAL                                                 '%2F%5Ba-z%5D%2B%5C%3A%2F'
        109        SEND_VAR                                                 !1
        110        DO_ICALL                                         $46     
        111      > JMPZ                                                     $46, ->114
        112    > > RETURN                                                   null
        113*       JMP                                                      ->116
   26   114    >   CONCAT                                           ~47     !3, !1
        115      > RETURN                                                   ~47
   28   116*       RETURN                                                   'NONE'
   29   117*     > RETURN                                                   null

End of function chiii

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
191.02 ms | 1411 KiB | 29 Q