3v4l.org

run code in 300+ PHP versions simultaneously
<?php function cleanUrl($value) { $url = parse_url($value); // Crap URLs (ie. without a scheme) only contain a path. if (!isset($url['host'])) { $url['host'] = rtrim($url['path'], '/'); $url['path'] = null; } $output = ''; $output .= !empty($url['scheme']) ? $url['scheme'] . '://' : 'http://'; // If unspecified, use HTTP. $output .= strtolower($url['host']); $output .= $url['path']; $output .= !empty($url['query']) ? '?' . $url['query'] : null; $output .= !empty($url['fragment']) ? '#' . $url['fragment'] : null; return $output; } print cleanUrl('http://google.com');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pHFag
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   INIT_FCALL                                               'cleanurl'
          1        SEND_VAL                                                 'http%3A%2F%2Fgoogle.com'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function cleanurl:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 17
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 25
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 41
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
2 jumps found. (Code = 43) Position 1 = 46, Position 2 = 50
Branch analysis from position: 46
1 jumps found. (Code = 42) Position 1 = 51
Branch analysis from position: 51
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 50
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 41
2 jumps found. (Code = 43) Position 1 = 46, Position 2 = 50
Branch analysis from position: 46
Branch analysis from position: 50
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 41
Branch analysis from position: 37
Branch analysis from position: 41
Branch analysis from position: 17
filename:       /in/pHFag
function name:  cleanUrl
number of ops:  54
compiled vars:  !0 = $value, !1 = $url, !2 = $output
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        INIT_FCALL                                               'parse_url'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !1, $3
    8     5        ISSET_ISEMPTY_DIM_OBJ                         0  ~5      !1, 'host'
          6        BOOL_NOT                                         ~6      ~5
          7      > JMPZ                                                     ~6, ->17
    9     8    >   INIT_FCALL                                               'rtrim'
          9        FETCH_DIM_R                                      ~8      !1, 'path'
         10        SEND_VAL                                                 ~8
         11        SEND_VAL                                                 '%2F'
         12        DO_ICALL                                         $9      
         13        ASSIGN_DIM                                               !1, 'host'
         14        OP_DATA                                                  $9
   10    15        ASSIGN_DIM                                               !1, 'path'
         16        OP_DATA                                                  null
   13    17    >   ASSIGN                                                   !2, ''
   14    18        ISSET_ISEMPTY_DIM_OBJ                         1  ~12     !1, 'scheme'
         19        BOOL_NOT                                         ~13     ~12
         20      > JMPZ                                                     ~13, ->25
         21    >   FETCH_DIM_R                                      ~14     !1, 'scheme'
         22        CONCAT                                           ~15     ~14, '%3A%2F%2F'
         23        QM_ASSIGN                                        ~16     ~15
         24      > JMP                                                      ->26
         25    >   QM_ASSIGN                                        ~16     'http%3A%2F%2F'
         26    >   ASSIGN_OP                                     8          !2, ~16
   15    27        INIT_FCALL                                               'strtolower'
         28        FETCH_DIM_R                                      ~18     !1, 'host'
         29        SEND_VAL                                                 ~18
         30        DO_ICALL                                         $19     
         31        ASSIGN_OP                                     8          !2, $19
   16    32        FETCH_DIM_R                                      ~21     !1, 'path'
         33        ASSIGN_OP                                     8          !2, ~21
   17    34        ISSET_ISEMPTY_DIM_OBJ                         1  ~23     !1, 'query'
         35        BOOL_NOT                                         ~24     ~23
         36      > JMPZ                                                     ~24, ->41
         37    >   FETCH_DIM_R                                      ~25     !1, 'query'
         38        CONCAT                                           ~26     '%3F', ~25
         39        QM_ASSIGN                                        ~27     ~26
         40      > JMP                                                      ->42
         41    >   QM_ASSIGN                                        ~27     null
         42    >   ASSIGN_OP                                     8          !2, ~27
   18    43        ISSET_ISEMPTY_DIM_OBJ                         1  ~29     !1, 'fragment'
         44        BOOL_NOT                                         ~30     ~29
         45      > JMPZ                                                     ~30, ->50
         46    >   FETCH_DIM_R                                      ~31     !1, 'fragment'
         47        CONCAT                                           ~32     '%23', ~31
         48        QM_ASSIGN                                        ~33     ~32
         49      > JMP                                                      ->51
         50    >   QM_ASSIGN                                        ~33     null
         51    >   ASSIGN_OP                                     8          !2, ~33
   20    52      > RETURN                                                   !2
   21    53*     > RETURN                                                   null

End of function cleanurl

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.93 ms | 1403 KiB | 20 Q