3v4l.org

run code in 300+ PHP versions simultaneously
<?php $list=array(5,2,3,9); function my_sum ($list){ $count = 0; for ($i=0; $i<= Array_count_values($list); $i++){ $count = $count + $list[i]; return $count; } } $sum = my_sum($list); print("The sum of all array elements is $sum <br />"); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/V5aGI
function name:  (null)
number of ops:  10
compiled vars:  !0 = $list, !1 = $sum
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   10     1        INIT_FCALL                                               'my_sum'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $3      
          4        ASSIGN                                                   !1, $3
   11     5        ROPE_INIT                                     3  ~6      'The+sum+of+all+array+elements+is+'
          6        ROPE_ADD                                      1  ~6      ~6, !1
          7        ROPE_END                                      2  ~5      ~6, '+%3Cbr+%2F%3E'
          8        ECHO                                                     ~5
   12     9      > RETURN                                                   1

Function my_sum:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 4
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/V5aGI
function name:  my_sum
number of ops:  16
compiled vars:  !0 = $list, !1 = $count, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, 0
    5     2        ASSIGN                                                   !2, 0
          3      > JMP                                                      ->10
    6     4    >   FETCH_CONSTANT                                   ~5      'i'
          5        FETCH_DIM_R                                      ~6      !0, ~5
          6        ADD                                              ~7      !1, ~6
          7        ASSIGN                                                   !1, ~7
    7     8      > RETURN                                                   !1
    5     9*       PRE_INC                                                  !2
         10    >   INIT_FCALL                                               'array_count_values'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                         $10     
         13        IS_SMALLER_OR_EQUAL                                      !2, $10
         14      > JMPNZ                                                    ~11, ->4
    9    15    > > RETURN                                                   null

End of function my_sum

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.28 ms | 1399 KiB | 16 Q