3v4l.org

run code in 300+ PHP versions simultaneously
<?php function file_uri_scheme($uri) { $position = strpos($uri, '://'); return $position ? substr($uri, 0, $position) : FALSE; } function file_uri_target($uri) { $data = explode('://', $uri, 2); // Remove erroneous leading or trailing, forward-slashes and backslashes. return count($data) == 2 ? trim($data[1], '\/') : FALSE; } function file_stream_wrapper_uri_normalize($uri) { $scheme = file_uri_scheme($uri); if ($scheme) { $target = file_uri_target($uri); if ($target !== FALSE) { $uri = $scheme . '://' . $target; } } return $uri; } $uri = 'test/example.exe'; echo file_stream_wrapper_uri_normalize($uri);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IX8V0
function name:  (null)
number of ops:  6
compiled vars:  !0 = $uri
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   ASSIGN                                                   !0, 'test%2Fexample.exe'
   30     1        INIT_FCALL                                               'file_stream_wrapper_uri_normalize'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $2      
          4        ECHO                                                     $2
          5      > RETURN                                                   1

Function file_uri_scheme:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 14
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IX8V0
function name:  file_uri_scheme
number of ops:  17
compiled vars:  !0 = $uri, !1 = $position
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'strpos'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 '%3A%2F%2F'
          4        DO_ICALL                                         $2      
          5        ASSIGN                                                   !1, $2
    5     6      > JMPZ                                                     !1, ->14
          7    >   INIT_FCALL                                               'substr'
          8        SEND_VAR                                                 !0
          9        SEND_VAL                                                 0
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                         $4      
         12        QM_ASSIGN                                        ~5      $4
         13      > JMP                                                      ->15
         14    >   QM_ASSIGN                                        ~5      <false>
         15    > > RETURN                                                   ~5
    6    16*     > RETURN                                                   null

End of function file_uri_scheme

Function file_uri_target:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 17
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IX8V0
function name:  file_uri_target
number of ops:  20
compiled vars:  !0 = $uri, !1 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '%3A%2F%2F'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 2
          5        DO_ICALL                                         $2      
          6        ASSIGN                                                   !1, $2
   12     7        COUNT                                            ~4      !1
          8        IS_EQUAL                                                 ~4, 2
          9      > JMPZ                                                     ~5, ->17
         10    >   INIT_FCALL                                               'trim'
         11        FETCH_DIM_R                                      ~6      !1, 1
         12        SEND_VAL                                                 ~6
         13        SEND_VAL                                                 '%5C%2F'
         14        DO_ICALL                                         $7      
         15        QM_ASSIGN                                        ~8      $7
         16      > JMP                                                      ->18
         17    >   QM_ASSIGN                                        ~8      <false>
         18    > > RETURN                                                   ~8
   13    19*     > RETURN                                                   null

End of function file_uri_target

Function file_stream_wrapper_uri_normalize:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 15
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 15
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
Branch analysis from position: 15
filename:       /in/IX8V0
function name:  file_stream_wrapper_uri_normalize
number of ops:  17
compiled vars:  !0 = $uri, !1 = $scheme, !2 = $target
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   16     1        INIT_FCALL                                               'file_uri_scheme'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $3      
          4        ASSIGN                                                   !1, $3
   18     5      > JMPZ                                                     !1, ->15
   19     6    >   INIT_FCALL                                               'file_uri_target'
          7        SEND_VAR                                                 !0
          8        DO_FCALL                                      0  $5      
          9        ASSIGN                                                   !2, $5
   21    10        TYPE_CHECK                                  1018          !2
         11      > JMPZ                                                     ~7, ->15
   22    12    >   CONCAT                                           ~8      !1, '%3A%2F%2F'
         13        CONCAT                                           ~9      ~8, !2
         14        ASSIGN                                                   !0, ~9
   25    15    > > RETURN                                                   !0
   26    16*     > RETURN                                                   null

End of function file_stream_wrapper_uri_normalize

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.67 ms | 1403 KiB | 24 Q