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 <= count($list); $i++){ print($i."<br />"); $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/KY18G
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>
   11     1        INIT_FCALL                                               'my_sum'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $3      
          4        ASSIGN                                                   !1, $3
   12     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
   13     9      > RETURN                                                   1

Function my_sum:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 4
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KY18G
function name:  my_sum
number of ops:  15
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                                                      ->11
    6     4    >   CONCAT                                           ~5      !2, '%3Cbr+%2F%3E'
          5        ECHO                                                     ~5
    7     6        FETCH_DIM_R                                      ~6      !0, !2
          7        ADD                                              ~7      !1, ~6
          8        ASSIGN                                                   !1, ~7
    8     9      > RETURN                                                   !1
    5    10*       PRE_INC                                                  !2
         11    >   COUNT                                            ~10     !0
         12        IS_SMALLER_OR_EQUAL                                      !2, ~10
         13      > JMPNZ                                                    ~11, ->4
   10    14    > > RETURN                                                   null

End of function my_sum

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.14 ms | 1399 KiB | 14 Q