3v4l.org

run code in 300+ PHP versions simultaneously
<?php function my_sum ($list){ $count = 0; for ($i = 0; $i <= count($list); $i++){ print($i."<br />"); $count = $count + $list[$i]; return $count; } } $list = array(5,2,3,9); print(count($list)."<br />"); $sum = my_sum($list); print(count($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/LmhaU
function name:  (null)
number of ops:  15
compiled vars:  !0 = $list, !1 = $sum
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ASSIGN                                                   !0, <array>
   11     1        COUNT                                            ~3      !0
          2        CONCAT                                           ~4      ~3, '%3Cbr+%2F%3E'
          3        ECHO                                                     ~4
   13     4        INIT_FCALL                                               'my_sum'
          5        SEND_VAR                                                 !0
          6        DO_FCALL                                      0  $5      
          7        ASSIGN                                                   !1, $5
   14     8        COUNT                                            ~7      !0
          9        ECHO                                                     ~7
   15    10        ROPE_INIT                                     3  ~9      'The+sum+of+all+array+elements+is+'
         11        ROPE_ADD                                      1  ~9      ~9, !1
         12        ROPE_END                                      2  ~8      ~9, '+%3Cbr+%2F%3E'
         13        ECHO                                                     ~8
   16    14      > 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/LmhaU
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
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        ASSIGN                                                   !1, 0
    4     2        ASSIGN                                                   !2, 0
          3      > JMP                                                      ->11
    5     4    >   CONCAT                                           ~5      !2, '%3Cbr+%2F%3E'
          5        ECHO                                                     ~5
    6     6        FETCH_DIM_R                                      ~6      !0, !2
          7        ADD                                              ~7      !1, ~6
          8        ASSIGN                                                   !1, ~7
    7     9      > RETURN                                                   !1
    4    10*       PRE_INC                                                  !2
         11    >   COUNT                                            ~10     !0
         12        IS_SMALLER_OR_EQUAL                                      !2, ~10
         13      > JMPNZ                                                    ~11, ->4
    9    14    > > RETURN                                                   null

End of function my_sum

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.34 ms | 1399 KiB | 14 Q