3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Parse an address spec string into an array * * @param $address * @return array * @throws \LogicException */ function parseAddress($address) { if ((!($parts = parse_url($address)) && !($parts = parse_url(preg_replace('#^([^:]+:/)//#', '$1', $address)))) || !isset($parts['scheme']) ) { throw new LogicException('Invalid address spec: ' . $address); } $parts['scheme'] = strtolower($parts['scheme']); return $parts; } var_dump(parseAddress('unix:///foo/bar.sock'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Rj3XS
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'parseaddress'
          2        SEND_VAL                                                 'unix%3A%2F%2F%2Ffoo%2Fbar.sock'
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
          6      > RETURN                                                   1

Function parseaddress:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 7, Position 2 = 18
Branch analysis from position: 7
2 jumps found. (Code = 47) Position 1 = 19, Position 2 = 22
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 28
Branch analysis from position: 23
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
Branch analysis from position: 18
filename:       /in/Rj3XS
function name:  parseAddress
number of ops:  36
compiled vars:  !0 = $address, !1 = $parts
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   12     1        INIT_FCALL                                               'parse_url'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $2      
          4        ASSIGN                                           ~3      !1, $2
          5        BOOL_NOT                                         ~4      ~3
          6      > JMPZ_EX                                          ~4      ~4, ->18
          7    >   INIT_FCALL                                               'parse_url'
          8        INIT_FCALL                                               'preg_replace'
          9        SEND_VAL                                                 '%23%5E%28%5B%5E%3A%5D%2B%3A%2F%29%2F%2F%23'
         10        SEND_VAL                                                 '%241'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                         $5      
         13        SEND_VAR                                                 $5
         14        DO_ICALL                                         $6      
         15        ASSIGN                                           ~7      !1, $6
         16        BOOL_NOT                                         ~8      ~7
         17        BOOL                                             ~4      ~8
         18    > > JMPNZ_EX                                         ~4      ~4, ->22
   13    19    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~9      !1, 'scheme'
         20        BOOL_NOT                                         ~10     ~9
         21        BOOL                                             ~4      ~10
         22    > > JMPZ                                                     ~4, ->28
   15    23    >   NEW                                              $11     'LogicException'
         24        CONCAT                                           ~12     'Invalid+address+spec%3A+', !0
         25        SEND_VAL_EX                                              ~12
         26        DO_FCALL                                      0          
         27      > THROW                                         0          $11
   18    28    >   INIT_FCALL                                               'strtolower'
         29        FETCH_DIM_R                                      ~15     !1, 'scheme'
         30        SEND_VAL                                                 ~15
         31        DO_ICALL                                         $16     
         32        ASSIGN_DIM                                               !1, 'scheme'
         33        OP_DATA                                                  $16
   20    34      > RETURN                                                   !1
   21    35*     > RETURN                                                   null

End of function parseaddress

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.53 ms | 1402 KiB | 22 Q