3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo 'Welcome to PhpCodePad ....'; function getAffValue($site){ if (stripos($site, "flipkart") != FALSE) return "infoclipri"; if (stripos($site, "infibeam") != FALSE) return "clip"; if (stripos($site, "healthkart") != FALSE) return "CliprL3C2ATRJ1P"; return "clipr"; } function getAffParam($site){ if (stripos($site, "flipkart") != FALSE) return "affid"; if (stripos($site, "infibeam") != FALSE) return "trackId"; if (stripos($site, "healthkart") != FALSE) return "affid"; return "referrer"; } function urlFromParsedUrl($parsedurl){ return $parsedurl['scheme']."://".$parsedurl['host']."".$parsedurl['path']."?".$parsedurl['query']; } function affiliatize($link){ $parsedurl['host'] = ""; $parsedurl['path'] = ""; $parsedurl = parse_url($link); if($parsedurl === false)die('Malformed url'); $site = $parsedurl['host']; if(isset($parsedurl['query'])) $query = $parsedurl['query']; else $query = ""; $querylist = explode('&',$query); $queryarray = array(); if($query != ""){ foreach ($querylist as $elem) { $param = explode('=',$elem); $queryarray[$param[0]] = $param[1]; } } $queryarray[getAffParam($site)] = getAffValue($site); $parsedurl['query'] = http_build_query($queryarray); return urlFromParsedUrl($parsedurl); } echo affiliatize("https://itsourstudio.com/ProductDescription.php?cat=Party&pid=286");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GV8Yb
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ECHO                                                     'Welcome+to+PhpCodePad+....'
   50     1        INIT_FCALL                                               'affiliatize'
          2        SEND_VAL                                                 'https%3A%2F%2Fitsourstudio.com%2FProductDescription.php%3Fcat%3DParty%26pid%3D286'
          3        DO_FCALL                                      0  $0      
          4        ECHO                                                     $0
          5      > RETURN                                                   1

Function getaffvalue:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
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 = 21, Position 2 = 22
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GV8Yb
function name:  getAffValue
number of ops:  24
compiled vars:  !0 = $site
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'stripos'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 'flipkart'
          4        DO_ICALL                                         $1      
          5        BOOL                                             ~2      $1
          6      > JMPZ                                                     ~2, ->8
    5     7    > > RETURN                                                   'infoclipri'
    6     8    >   INIT_FCALL                                               'stripos'
          9        SEND_VAR                                                 !0
         10        SEND_VAL                                                 'infibeam'
         11        DO_ICALL                                         $3      
         12        BOOL                                             ~4      $3
         13      > JMPZ                                                     ~4, ->15
    7    14    > > RETURN                                                   'clip'
    8    15    >   INIT_FCALL                                               'stripos'
         16        SEND_VAR                                                 !0
         17        SEND_VAL                                                 'healthkart'
         18        DO_ICALL                                         $5      
         19        BOOL                                             ~6      $5
         20      > JMPZ                                                     ~6, ->22
    9    21    > > RETURN                                                   'CliprL3C2ATRJ1P'
   11    22    > > RETURN                                                   'clipr'
   12    23*     > RETURN                                                   null

End of function getaffvalue

Function getaffparam:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
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 = 21, Position 2 = 22
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GV8Yb
function name:  getAffParam
number of ops:  24
compiled vars:  !0 = $site
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   14     1        INIT_FCALL                                               'stripos'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 'flipkart'
          4        DO_ICALL                                         $1      
          5        BOOL                                             ~2      $1
          6      > JMPZ                                                     ~2, ->8
   15     7    > > RETURN                                                   'affid'
   16     8    >   INIT_FCALL                                               'stripos'
          9        SEND_VAR                                                 !0
         10        SEND_VAL                                                 'infibeam'
         11        DO_ICALL                                         $3      
         12        BOOL                                             ~4      $3
         13      > JMPZ                                                     ~4, ->15
   17    14    > > RETURN                                                   'trackId'
   18    15    >   INIT_FCALL                                               'stripos'
         16        SEND_VAR                                                 !0
         17        SEND_VAL                                                 'healthkart'
         18        DO_ICALL                                         $5      
         19        BOOL                                             ~6      $5
         20      > JMPZ                                                     ~6, ->22
   19    21    > > RETURN                                                   'affid'
   21    22    > > RETURN                                                   'referrer'
   22    23*     > RETURN                                                   null

End of function getaffparam

Function urlfromparsedurl:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GV8Yb
function name:  urlFromParsedUrl
number of ops:  13
compiled vars:  !0 = $parsedurl
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
   24     1        FETCH_DIM_R                                      ~1      !0, 'scheme'
          2        CONCAT                                           ~2      ~1, '%3A%2F%2F'
          3        FETCH_DIM_R                                      ~3      !0, 'host'
          4        CONCAT                                           ~4      ~2, ~3
          5        CONCAT                                           ~5      ~4, ''
          6        FETCH_DIM_R                                      ~6      !0, 'path'
          7        CONCAT                                           ~7      ~5, ~6
          8        CONCAT                                           ~8      ~7, '%3F'
          9        FETCH_DIM_R                                      ~9      !0, 'query'
         10        CONCAT                                           ~10     ~8, ~9
         11      > RETURN                                                   ~10
   25    12*     > RETURN                                                   null

End of function urlfromparsedurl

Function affiliatize:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 12
Branch analysis from position: 11
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 19
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 41
Branch analysis from position: 28
2 jumps found. (Code = 77) Position 1 = 29, Position 2 = 40
Branch analysis from position: 29
2 jumps found. (Code = 78) Position 1 = 30, Position 2 = 40
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
Branch analysis from position: 41
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 41
Branch analysis from position: 28
Branch analysis from position: 41
filename:       /in/GV8Yb
function name:  affiliatize
number of ops:  59
compiled vars:  !0 = $link, !1 = $parsedurl, !2 = $site, !3 = $query, !4 = $querylist, !5 = $queryarray, !6 = $elem, !7 = $param
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   RECV                                             !0      
   28     1        ASSIGN_DIM                                               !1, 'host'
          2        OP_DATA                                                  ''
   29     3        ASSIGN_DIM                                               !1, 'path'
          4        OP_DATA                                                  ''
   30     5        INIT_FCALL                                               'parse_url'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $10     
          8        ASSIGN                                                   !1, $10
   31     9        TYPE_CHECK                                    4          !1
         10      > JMPZ                                                     ~12, ->12
         11    > > EXIT                                                     'Malformed+url'
   32    12    >   FETCH_DIM_R                                      ~13     !1, 'host'
         13        ASSIGN                                                   !2, ~13
   33    14        ISSET_ISEMPTY_DIM_OBJ                         0          !1, 'query'
         15      > JMPZ                                                     ~15, ->19
   34    16    >   FETCH_DIM_R                                      ~16     !1, 'query'
         17        ASSIGN                                                   !3, ~16
         18      > JMP                                                      ->20
   36    19    >   ASSIGN                                                   !3, ''
   38    20    >   INIT_FCALL                                               'explode'
         21        SEND_VAL                                                 '%26'
         22        SEND_VAR                                                 !3
         23        DO_ICALL                                         $19     
         24        ASSIGN                                                   !4, $19
   39    25        ASSIGN                                                   !5, <array>
   40    26        IS_NOT_EQUAL                                             !3, ''
         27      > JMPZ                                                     ~22, ->41
   41    28    > > FE_RESET_R                                       $23     !4, ->40
         29    > > FE_FETCH_R                                               $23, !6, ->40
   42    30    >   INIT_FCALL                                               'explode'
         31        SEND_VAL                                                 '%3D'
         32        SEND_VAR                                                 !6
         33        DO_ICALL                                         $24     
         34        ASSIGN                                                   !7, $24
   43    35        FETCH_DIM_R                                      ~26     !7, 0
         36        FETCH_DIM_R                                      ~28     !7, 1
         37        ASSIGN_DIM                                               !5, ~26
         38        OP_DATA                                                  ~28
   41    39      > JMP                                                      ->29
         40    >   FE_FREE                                                  $23
   46    41    >   INIT_FCALL                                               'getaffparam'
         42        SEND_VAR                                                 !2
         43        DO_FCALL                                      0  $29     
         44        INIT_FCALL                                               'getaffvalue'
         45        SEND_VAR                                                 !2
         46        DO_FCALL                                      0  $31     
         47        ASSIGN_DIM                                               !5, $29
         48        OP_DATA                                                  $31
   47    49        INIT_FCALL                                               'http_build_query'
         50        SEND_VAR                                                 !5
         51        DO_ICALL                                         $33     
         52        ASSIGN_DIM                                               !1, 'query'
         53        OP_DATA                                                  $33
   48    54        INIT_FCALL                                               'urlfromparsedurl'
         55        SEND_VAR                                                 !1
         56        DO_FCALL                                      0  $34     
         57      > RETURN                                                   $34
   49    58*     > RETURN                                                   null

End of function affiliatize

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.41 ms | 1411 KiB | 25 Q