3v4l.org

run code in 500+ PHP versions simultaneously
<?php function a($uri) { $uri_parts = explode('://', $uri, 2); $length = strpos($uri_parts[1], '/'); return ($length === FALSE) ? $uri_parts[1] : substr($uri_parts[1], 0, $length); } function b($uri) { $uri_parts = explode('://', $uri, 2); return strtok($uri_parts[1], '/'); } var_dump(a('module://node')); var_dump(a('module://node/')); var_dump(a('module://node/node.info.yml')); var_dump(b('module://node')); var_dump(b('module://node/')); var_dump(b('module://node/node.info.yml'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/V9B14
function name:  (null)
number of ops:  37
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                                   'var_dump'
          1        INIT_FCALL                                                   'a'
          2        SEND_VAL                                                     'module%3A%2F%2Fnode'
          3        DO_FCALL                                          0  $0      
          4        SEND_VAR                                                     $0
          5        DO_ICALL                                                     
   15     6        INIT_FCALL                                                   'var_dump'
          7        INIT_FCALL                                                   'a'
          8        SEND_VAL                                                     'module%3A%2F%2Fnode%2F'
          9        DO_FCALL                                          0  $2      
         10        SEND_VAR                                                     $2
         11        DO_ICALL                                                     
   16    12        INIT_FCALL                                                   'var_dump'
         13        INIT_FCALL                                                   'a'
         14        SEND_VAL                                                     'module%3A%2F%2Fnode%2Fnode.info.yml'
         15        DO_FCALL                                          0  $4      
         16        SEND_VAR                                                     $4
         17        DO_ICALL                                                     
   18    18        INIT_FCALL                                                   'var_dump'
         19        INIT_FCALL                                                   'b'
         20        SEND_VAL                                                     'module%3A%2F%2Fnode'
         21        DO_FCALL                                          0  $6      
         22        SEND_VAR                                                     $6
         23        DO_ICALL                                                     
   19    24        INIT_FCALL                                                   'var_dump'
         25        INIT_FCALL                                                   'b'
         26        SEND_VAL                                                     'module%3A%2F%2Fnode%2F'
         27        DO_FCALL                                          0  $8      
         28        SEND_VAR                                                     $8
         29        DO_ICALL                                                     
   20    30        INIT_FCALL                                                   'var_dump'
         31        INIT_FCALL                                                   'b'
         32        SEND_VAL                                                     'module%3A%2F%2Fnode%2Fnode.info.yml'
         33        DO_FCALL                                          0  $10     
         34        SEND_VAR                                                     $10
         35        DO_ICALL                                                     
         36      > RETURN                                                       1

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

End of function a

Function b:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/V9B14
function name:  b
number of ops:  14
compiled vars:  !0 = $uri, !1 = $uri_parts
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   RECV                                                 !0      
   10     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
   11     7        INIT_FCALL                                                   'strtok'
          8        FETCH_DIM_R                                          ~4      !1, 1
          9        SEND_VAL                                                     ~4
         10        SEND_VAL                                                     '%2F'
         11        DO_ICALL                                             $5      
         12      > RETURN                                                       $5
   12    13*     > RETURN                                                       null

End of function b

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
178.1 ms | 2264 KiB | 26 Q