3v4l.org

run code in 300+ PHP versions simultaneously
<?php /*function rev($str) { if ( ! $str ) { return; } return rev(substr($str,1)) . $str{0}; }*/ function sum($arr) { if ( empty($arr) ) { return; } return $arr[0] + sum(array_slice($arr,1)); } $a = array(5,4,7,8,9,3); echo sum($a);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nvZKa
function name:  (null)
number of ops:  6
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   ASSIGN                                                   !0, <array>
   17     1        INIT_FCALL                                               'sum'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $2      
          4        ECHO                                                     $2
          5      > RETURN                                                   1

Function sum:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 4
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nvZKa
function name:  sum
number of ops:  15
compiled vars:  !0 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   10     1        ISSET_ISEMPTY_CV                                         !0
          2      > JMPZ                                                     ~1, ->4
   11     3    > > RETURN                                                   null
   13     4    >   FETCH_DIM_R                                      ~2      !0, 0
          5        INIT_FCALL_BY_NAME                                       'sum'
          6        INIT_FCALL                                               'array_slice'
          7        SEND_VAR                                                 !0
          8        SEND_VAL                                                 1
          9        DO_ICALL                                         $3      
         10        SEND_VAR_NO_REF_EX                                       $3
         11        DO_FCALL                                      0  $4      
         12        ADD                                              ~5      ~2, $4
         13      > RETURN                                                   ~5
   14    14*     > RETURN                                                   null

End of function sum

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.74 ms | 1398 KiB | 16 Q