3v4l.org

run code in 300+ PHP versions simultaneously
<?php $elems = [-1, 3, -4, 5, 1, -6, 2, 1]; function solution(array $A) { // write your code in PHP5.5 $equilibriums = array(); for($i = 0, $n = sizeof($arr);$i < $n;++$i) { if(array_sum(array_slice($arr, 0, $i)) == array_sum(array_slice($arr, $i + 1))) { $equilibriums[] = $i; } } return $equilibriums; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AodLP
function name:  (null)
number of ops:  2
compiled vars:  !0 = $elems
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   15     1      > RETURN                                                   1

Function solution:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 6
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 26
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 6
Branch analysis from position: 29
Branch analysis from position: 6
Branch analysis from position: 26
filename:       /in/AodLP
function name:  solution
number of ops:  31
compiled vars:  !0 = $A, !1 = $equilibriums, !2 = $i, !3 = $n, !4 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    8     1        ASSIGN                                                   !1, <array>
    9     2        ASSIGN                                                   !2, 0
          3        COUNT                                            ~7      !4
          4        ASSIGN                                                   !3, ~7
          5      > JMP                                                      ->27
   10     6    >   INIT_FCALL                                               'array_sum'
          7        INIT_FCALL                                               'array_slice'
          8        SEND_VAR                                                 !4
          9        SEND_VAL                                                 0
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                         $9      
         12        SEND_VAR                                                 $9
         13        DO_ICALL                                         $10     
         14        INIT_FCALL                                               'array_sum'
         15        INIT_FCALL                                               'array_slice'
         16        SEND_VAR                                                 !4
         17        ADD                                              ~11     !2, 1
         18        SEND_VAL                                                 ~11
         19        DO_ICALL                                         $12     
         20        SEND_VAR                                                 $12
         21        DO_ICALL                                         $13     
         22        IS_EQUAL                                                 $10, $13
         23      > JMPZ                                                     ~14, ->26
   11    24    >   ASSIGN_DIM                                               !1
         25        OP_DATA                                                  !2
    9    26    >   PRE_INC                                                  !2
         27    >   IS_SMALLER                                               !2, !3
         28      > JMPNZ                                                    ~17, ->6
   14    29    > > RETURN                                                   !1
   15    30*     > RETURN                                                   null

End of function solution

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
195.37 ms | 1396 KiB | 17 Q