3v4l.org

run code in 300+ PHP versions simultaneously
<?php function url_parse($url){ $sflfdfldf=$url; if(strpos($url,"?")>-1){ $a=explode("?",$url,2); $url=$a[0]; $query=$a[1]; } if(strpos($url,"://")>-1){ $scheme=substr($url,0,strpos($url,"//")-1); $url=substr($url,strpos($url,"//")+2,strlen($url)); } if(strpos($url,"/")>-1){ $a=explode("/",$url,2); $url=$a[0]; $path="/".$a[1]; } if(strpos($url,":")>-1){ $a=explode(":",$url,2); $url=$a[0]; $port=$a[1]; } $host=$url; $url=null; foreach(array("url","scheme","host","port","path","query") as $var){ if(!empty($$var)){ $return[$var]=$$var; } } //return array("url"=>$sflfdfldf,"scheme"=>$scheme,"host"=>$host,"port"=>$port,"path"=>$path,"query"=>$query,"a"=>$url); return $return; } ?> <?php /* Compare two outputs */ //mine print_r(url_parse("http://w.login.yahoo.com?.src=ym&.intl=gb&.lang=zh-Hans-HK&.done=https://mail.yahoo.com")); //internal print_r(parse_url("http://w.login.yahoo.com?.src=ym&.intl=gb&.lang=zh-Hans-HK&.done=https://mail.yahoo.com"));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DpYXS
function name:  (null)
number of ops:  14
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   ECHO                                                     '%0A'
   39     1        INIT_FCALL                                               'print_r'
          2        INIT_FCALL                                               'url_parse'
          3        SEND_VAL                                                 'http%3A%2F%2Fw.login.yahoo.com%3F.src%3Dym%26.intl%3Dgb%26.lang%3Dzh-Hans-HK%26.done%3Dhttps%3A%2F%2Fmail.yahoo.com'
          4        DO_FCALL                                      0  $0      
          5        SEND_VAR                                                 $0
          6        DO_ICALL                                                 
   41     7        INIT_FCALL                                               'print_r'
          8        INIT_FCALL                                               'parse_url'
          9        SEND_VAL                                                 'http%3A%2F%2Fw.login.yahoo.com%3F.src%3Dym%26.intl%3Dgb%26.lang%3Dzh-Hans-HK%26.done%3Dhttps%3A%2F%2Fmail.yahoo.com'
         10        DO_ICALL                                         $2      
         11        SEND_VAR                                                 $2
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Function url_parse:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 18
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 47
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 53, Position 2 = 64
Branch analysis from position: 53
2 jumps found. (Code = 43) Position 1 = 70, Position 2 = 80
Branch analysis from position: 70
2 jumps found. (Code = 77) Position 1 = 83, Position 2 = 91
Branch analysis from position: 83
2 jumps found. (Code = 78) Position 1 = 84, Position 2 = 91
Branch analysis from position: 84
2 jumps found. (Code = 43) Position 1 = 87, Position 2 = 90
Branch analysis from position: 87
1 jumps found. (Code = 42) Position 1 = 83
Branch analysis from position: 83
Branch analysis from position: 90
Branch analysis from position: 91
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 91
Branch analysis from position: 80
Branch analysis from position: 64
Branch analysis from position: 47
Branch analysis from position: 18
filename:       /in/DpYXS
function name:  url_parse
number of ops:  94
compiled vars:  !0 = $url, !1 = $sflfdfldf, !2 = $a, !3 = $query, !4 = $scheme, !5 = $path, !6 = $port, !7 = $host, !8 = $var, !9 = $return
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, !0
    5     2        INIT_FCALL                                               'strpos'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 '%3F'
          5        DO_ICALL                                         $11     
          6        IS_SMALLER                                               -1, $11
          7      > JMPZ                                                     ~12, ->18
    6     8    >   INIT_FCALL                                               'explode'
          9        SEND_VAL                                                 '%3F'
         10        SEND_VAR                                                 !0
         11        SEND_VAL                                                 2
         12        DO_ICALL                                         $13     
         13        ASSIGN                                                   !2, $13
    7    14        FETCH_DIM_R                                      ~15     !2, 0
         15        ASSIGN                                                   !0, ~15
    8    16        FETCH_DIM_R                                      ~17     !2, 1
         17        ASSIGN                                                   !3, ~17
   10    18    >   INIT_FCALL                                               'strpos'
         19        SEND_VAR                                                 !0
         20        SEND_VAL                                                 '%3A%2F%2F'
         21        DO_ICALL                                         $19     
         22        IS_SMALLER                                               -1, $19
         23      > JMPZ                                                     ~20, ->47
   11    24    >   INIT_FCALL                                               'substr'
         25        SEND_VAR                                                 !0
         26        SEND_VAL                                                 0
         27        INIT_FCALL                                               'strpos'
         28        SEND_VAR                                                 !0
         29        SEND_VAL                                                 '%2F%2F'
         30        DO_ICALL                                         $21     
         31        SUB                                              ~22     $21, 1
         32        SEND_VAL                                                 ~22
         33        DO_ICALL                                         $23     
         34        ASSIGN                                                   !4, $23
   12    35        INIT_FCALL                                               'substr'
         36        SEND_VAR                                                 !0
         37        INIT_FCALL                                               'strpos'
         38        SEND_VAR                                                 !0
         39        SEND_VAL                                                 '%2F%2F'
         40        DO_ICALL                                         $25     
         41        ADD                                              ~26     $25, 2
         42        SEND_VAL                                                 ~26
         43        STRLEN                                           ~27     !0
         44        SEND_VAL                                                 ~27
         45        DO_ICALL                                         $28     
         46        ASSIGN                                                   !0, $28
   14    47    >   INIT_FCALL                                               'strpos'
         48        SEND_VAR                                                 !0
         49        SEND_VAL                                                 '%2F'
         50        DO_ICALL                                         $30     
         51        IS_SMALLER                                               -1, $30
         52      > JMPZ                                                     ~31, ->64
   15    53    >   INIT_FCALL                                               'explode'
         54        SEND_VAL                                                 '%2F'
         55        SEND_VAR                                                 !0
         56        SEND_VAL                                                 2
         57        DO_ICALL                                         $32     
         58        ASSIGN                                                   !2, $32
   16    59        FETCH_DIM_R                                      ~34     !2, 0
         60        ASSIGN                                                   !0, ~34
   17    61        FETCH_DIM_R                                      ~36     !2, 1
         62        CONCAT                                           ~37     '%2F', ~36
         63        ASSIGN                                                   !5, ~37
   19    64    >   INIT_FCALL                                               'strpos'
         65        SEND_VAR                                                 !0
         66        SEND_VAL                                                 '%3A'
         67        DO_ICALL                                         $39     
         68        IS_SMALLER                                               -1, $39
         69      > JMPZ                                                     ~40, ->80
   20    70    >   INIT_FCALL                                               'explode'
         71        SEND_VAL                                                 '%3A'
         72        SEND_VAR                                                 !0
         73        SEND_VAL                                                 2
         74        DO_ICALL                                         $41     
         75        ASSIGN                                                   !2, $41
   21    76        FETCH_DIM_R                                      ~43     !2, 0
         77        ASSIGN                                                   !0, ~43
   22    78        FETCH_DIM_R                                      ~45     !2, 1
         79        ASSIGN                                                   !6, ~45
   24    80    >   ASSIGN                                                   !7, !0
   25    81        ASSIGN                                                   !0, null
   26    82      > FE_RESET_R                                       $49     <array>, ->91
         83    > > FE_FETCH_R                                               $49, !8, ->91
   27    84    >   ISSET_ISEMPTY_VAR                             5  ~50     !8
         85        BOOL_NOT                                         ~51     ~50
         86      > JMPZ                                                     ~51, ->90
   28    87    >   FETCH_R                      local               ~53     !8
         88        ASSIGN_DIM                                               !9, !8
         89        OP_DATA                                                  ~53
   26    90    > > JMP                                                      ->83
         91    >   FE_FREE                                                  $49
   32    92      > RETURN                                                   !9
   33    93*     > RETURN                                                   null

End of function url_parse

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.58 ms | 1407 KiB | 24 Q