3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo($path) { if ($path && $path[0] = '/') { $path = substr($path, 1); } $url = 'http://' . 'www.example.com/' . $url; echo $url; return $url; } foo('/abc'); foo('abc'); foo('/'); foo('');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3JCRD
function name:  (null)
number of ops:  13
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_FCALL                                               'foo'
          1        SEND_VAL                                                 '%2Fabc'
          2        DO_FCALL                                      0          
   11     3        INIT_FCALL                                               'foo'
          4        SEND_VAL                                                 'abc'
          5        DO_FCALL                                      0          
   12     6        INIT_FCALL                                               'foo'
          7        SEND_VAL                                                 '%2F'
          8        DO_FCALL                                      0          
   13     9        INIT_FCALL                                               'foo'
         10        SEND_VAL                                                 ''
         11        DO_FCALL                                      0          
         12      > RETURN                                                   1

Function foo:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 2, Position 2 = 5
Branch analysis from position: 2
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 11
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
Branch analysis from position: 5
filename:       /in/3JCRD
function name:  foo
number of ops:  16
compiled vars:  !0 = $path, !1 = $url
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1      > JMPZ_EX                                          ~2      !0, ->5
          2    >   ASSIGN_DIM                                       ~3      !0, 0
          3        OP_DATA                                                  '%2F'
          4        BOOL                                             ~2      ~3
          5    > > JMPZ                                                     ~2, ->11
    4     6    >   INIT_FCALL                                               'substr'
          7        SEND_VAR                                                 !0
          8        SEND_VAL                                                 1
          9        DO_ICALL                                         $4      
         10        ASSIGN                                                   !0, $4
    6    11    >   CONCAT                                           ~6      'http%3A%2F%2Fwww.example.com%2F', !1
         12        ASSIGN                                                   !1, ~6
    7    13        ECHO                                                     !1
    8    14      > RETURN                                                   !1
    9    15*     > RETURN                                                   null

End of function foo

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.01 ms | 1390 KiB | 19 Q