3v4l.org

run code in 300+ 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 = 15, Position 2 = 18
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/V9B14
function name:  a
number of ops:  27
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        INIT_FCALL                                               'strpos'
          8        FETCH_DIM_R                                      ~5      !1, 1
          9        SEND_VAL                                                 ~5
         10        SEND_VAL                                                 '%2F'
         11        DO_ICALL                                         $6      
         12        ASSIGN                                                   !2, $6
    6    13        TYPE_CHECK                                    4          !2
         14      > JMPZ                                                     ~8, ->18
         15    >   FETCH_DIM_R                                      ~9      !1, 1
         16        QM_ASSIGN                                        ~10     ~9
         17      > JMP                                                      ->25
         18    >   INIT_FCALL                                               'substr'
         19        FETCH_DIM_R                                      ~11     !1, 1
         20        SEND_VAL                                                 ~11
         21        SEND_VAL                                                 0
         22        SEND_VAR                                                 !2
         23        DO_ICALL                                         $12     
         24        QM_ASSIGN                                        ~10     $12
         25    > > RETURN                                                   ~10
    7    26*     > 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.0.0


preferences:
182.14 ms | 1403 KiB | 29 Q