3v4l.org

run code in 300+ PHP versions simultaneously
<?php function my_sum ($list){ print(count($list)); $sum = 0; for ($i = 0; $i <= count($list); $i++){ print($i."<br />"); $sum = $sum + $list[$i]; return $sum; } } $list = array(5,2,3,9); $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/6ODSi
function name:  (null)
number of ops:  10
compiled vars:  !0 = $list, !1 = $sum
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ASSIGN                                                   !0, <array>
   12     1        INIT_FCALL                                               'my_sum'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $3      
          4        ASSIGN                                                   !1, $3
   13     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
   14     9      > RETURN                                                   1

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

End of function my_sum

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.23 ms | 1399 KiB | 14 Q