3v4l.org

run code in 300+ PHP versions simultaneously
<?php function my_sum ($list){ $list_length = count($list); $sum = 0; for ($i = 0; $i < $list_length; $i++){ print($i."<br />"); $sum = $sum + $list[$i]; return $sum; } } $list = array(5,2,3,9); $test = my_sum($list); print("The sum of all array elements is $test <br />"); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BOd8T
function name:  (null)
number of ops:  10
compiled vars:  !0 = $list, !1 = $test
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 = 15, Position 2 = 6
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BOd8T
function name:  my_sum
number of ops:  16
compiled vars:  !0 = $list, !1 = $list_length, !2 = $sum, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        COUNT                                            ~4      !0
          2        ASSIGN                                                   !1, ~4
    4     3        ASSIGN                                                   !2, 0
    5     4        ASSIGN                                                   !3, 0
          5      > JMP                                                      ->13
    6     6    >   CONCAT                                           ~8      !3, '%3Cbr+%2F%3E'
          7        ECHO                                                     ~8
    7     8        FETCH_DIM_R                                      ~9      !0, !3
          9        ADD                                              ~10     !2, ~9
         10        ASSIGN                                                   !2, ~10
    8    11      > RETURN                                                   !2
    5    12*       PRE_INC                                                  !3
         13    >   IS_SMALLER                                               !3, !1
         14      > JMPNZ                                                    ~13, ->6
   10    15    > > RETURN                                                   null

End of function my_sum

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.79 ms | 1390 KiB | 14 Q