3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = [ -7, 1, 5, 2, -4, 2, 1 ]; for($i=count($a)-1,$c=0;$i+1&&$c!=(array_sum($a)-$a[$i])/2;$c+=$a[$i--]);echo $i;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
2 jumps found. (Code = 46) Position 1 = 11, Position 2 = 19
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 6
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 46) Position 1 = 11, Position 2 = 19
Branch analysis from position: 11
Branch analysis from position: 19
Branch analysis from position: 19
filename:       /in/qJvhO
function name:  (null)
number of ops:  22
compiled vars:  !0 = $a, !1 = $i, !2 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        COUNT                                            ~4      !0
          2        SUB                                              ~5      ~4, 1
          3        ASSIGN                                                   !1, ~5
          4        ASSIGN                                                   !2, 0
          5      > JMP                                                      ->9
          6    >   POST_DEC                                         ~8      !1
          7        FETCH_DIM_R                                      ~9      !0, ~8
          8        ASSIGN_OP                                     1          !2, ~9
          9    >   ADD                                              ~11     !1, 1
         10      > JMPZ_EX                                          ~11     ~11, ->19
         11    >   INIT_FCALL                                               'array_sum'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                         $12     
         14        FETCH_DIM_R                                      ~13     !0, !1
         15        SUB                                              ~14     $12, ~13
         16        DIV                                              ~15     ~14, 2
         17        IS_NOT_EQUAL                                     ~16     !2, ~15
         18        BOOL                                             ~11     ~16
         19    > > JMPNZ                                                    ~11, ->6
         20    >   ECHO                                                     !1
         21      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.52 ms | 1395 KiB | 15 Q