3v4l.org

run code in 300+ PHP versions simultaneously
<?php $nums = [1,4,6]; function addNextNumber($current, array $nums) { $current += array_pop($nums); if (count($nums) === 0) { return $current; } return addNextNumber($current, $nums); } $result = addNextNumber(0, $nums); var_dump($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3PKWA
function name:  (null)
number of ops:  10
compiled vars:  !0 = $nums, !1 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   15     1        INIT_FCALL                                               'addnextnumber'
          2        SEND_VAL                                                 0
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $3      
          5        ASSIGN                                                   !1, $3
   16     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Function addnextnumber:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 10
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3PKWA
function name:  addNextNumber
number of ops:  16
compiled vars:  !0 = $current, !1 = $nums
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    6     2        INIT_FCALL                                               'array_pop'
          3        SEND_REF                                                 !1
          4        DO_ICALL                                         $2      
          5        ASSIGN_OP                                     1          !0, $2
    8     6        COUNT                                            ~4      !1
          7        IS_IDENTICAL                                             ~4, 0
          8      > JMPZ                                                     ~5, ->10
    9     9    > > RETURN                                                   !0
   12    10    >   INIT_FCALL_BY_NAME                                       'addNextNumber'
         11        SEND_VAR_EX                                              !0
         12        SEND_VAR_EX                                              !1
         13        DO_FCALL                                      0  $6      
         14      > RETURN                                                   $6
   13    15*     > RETURN                                                   null

End of function addnextnumber

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.27 ms | 1399 KiB | 18 Q