3v4l.org

run code in 300+ PHP versions simultaneously
<?php function path_relative_to($path, $rel) { $rel_lent = strlen($rel); if (strncmp($path, $ref, strlen($rel)) == 0) { return substr($path, strlen($rel)); } else { return ""; } } var_dump(path_relative_to("a/b/c", "a"));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KG2lZ
function name:  (null)
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'path_relative_to'
          2        SEND_VAL                                                 'a%2Fb%2Fc'
          3        SEND_VAL                                                 'a'
          4        DO_FCALL                                      0  $0      
          5        SEND_VAR                                                 $0
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

Function path_relative_to:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 19
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KG2lZ
function name:  path_relative_to
number of ops:  21
compiled vars:  !0 = $path, !1 = $rel, !2 = $rel_lent, !3 = $ref
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        STRLEN                                           ~4      !1
          3        ASSIGN                                                   !2, ~4
    6     4        INIT_FCALL                                               'strncmp'
          5        SEND_VAR                                                 !0
          6        SEND_VAR                                                 !3
          7        STRLEN                                           ~6      !1
          8        SEND_VAL                                                 ~6
          9        DO_ICALL                                         $7      
         10        IS_EQUAL                                                 $7, 0
         11      > JMPZ                                                     ~8, ->19
    8    12    >   INIT_FCALL                                               'substr'
         13        SEND_VAR                                                 !0
         14        STRLEN                                           ~9      !1
         15        SEND_VAL                                                 ~9
         16        DO_ICALL                                         $10     
         17      > RETURN                                                   $10
         18*       JMP                                                      ->20
   12    19    > > RETURN                                                   ''
   14    20*     > RETURN                                                   null

End of function path_relative_to

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.65 ms | 1403 KiB | 20 Q