3v4l.org

run code in 300+ PHP versions simultaneously
<?php $count = 0; function p($x, &$count) { $count++; if ($x<= 2) { return 2; } else { return p($x-1)+p($x-2) -1; } } $b = p(5, $count); $c = p($b, $count); var_dump($c); echo $count;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bVFU6
function name:  (null)
number of ops:  16
compiled vars:  !0 = $count, !1 = $b, !2 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 0
   14     1        INIT_FCALL                                               'p'
          2        SEND_VAL                                                 5
          3        SEND_REF                                                 !0
          4        DO_FCALL                                      0  $4      
          5        ASSIGN                                                   !1, $4
   15     6        INIT_FCALL                                               'p'
          7        SEND_VAR                                                 !1
          8        SEND_REF                                                 !0
          9        DO_FCALL                                      0  $6      
         10        ASSIGN                                                   !2, $6
   16    11        INIT_FCALL                                               'var_dump'
         12        SEND_VAR                                                 !2
         13        DO_ICALL                                                 
   17    14        ECHO                                                     !0
         15      > RETURN                                                   1

Function p:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bVFU6
function name:  p
number of ops:  19
compiled vars:  !0 = $x, !1 = $count
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    6     2        PRE_INC                                                  !1
    7     3        IS_SMALLER_OR_EQUAL                                      !0, 2
          4      > JMPZ                                                     ~3, ->7
    8     5    > > RETURN                                                   2
          6*       JMP                                                      ->18
   10     7    >   INIT_FCALL_BY_NAME                                       'p'
          8        SUB                                              ~4      !0, 1
          9        SEND_VAL_EX                                              ~4
         10        DO_FCALL                                      0  $5      
         11        INIT_FCALL_BY_NAME                                       'p'
         12        SUB                                              ~6      !0, 2
         13        SEND_VAL_EX                                              ~6
         14        DO_FCALL                                      0  $7      
         15        ADD                                              ~8      $5, $7
         16        SUB                                              ~9      ~8, 1
         17      > RETURN                                                   ~9
   12    18*     > RETURN                                                   null

End of function p

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.89 ms | 1390 KiB | 17 Q