3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = range(1, 3); $result = []; foreach ($array as $shifter => $unused) { foreach ($array as $index => $value) { $key = $shifter + $index; $result[$key] = ($result[$key] ?? 0) + $value; } } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 23
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 23
Branch analysis from position: 8
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 21
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 21
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 21
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/tOqWm
function name:  (null)
number of ops:  28
compiled vars:  !0 = $array, !1 = $result, !2 = $unused, !3 = $shifter, !4 = $value, !5 = $index, !6 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'range'
          1        SEND_VAL                                                 1
          2        SEND_VAL                                                 3
          3        DO_ICALL                                         $7      
          4        ASSIGN                                                   !0, $7
    4     5        ASSIGN                                                   !1, <array>
    5     6      > FE_RESET_R                                       $10     !0, ->23
          7    > > FE_FETCH_R                                       ~11     $10, !2, ->23
          8    >   ASSIGN                                                   !3, ~11
    6     9      > FE_RESET_R                                       $13     !0, ->21
         10    > > FE_FETCH_R                                       ~14     $13, !4, ->21
         11    >   ASSIGN                                                   !5, ~14
    7    12        ADD                                              ~16     !3, !5
         13        ASSIGN                                                   !6, ~16
    8    14        FETCH_DIM_IS                                     ~19     !1, !6
         15        COALESCE                                         ~20     ~19
         16        QM_ASSIGN                                        ~20     0
         17        ADD                                              ~21     ~20, !4
         18        ASSIGN_DIM                                               !1, !6
         19        OP_DATA                                                  ~21
    6    20      > JMP                                                      ->10
         21    >   FE_FREE                                                  $13
    5    22      > JMP                                                      ->7
         23    >   FE_FREE                                                  $10
   11    24        INIT_FCALL                                               'var_export'
         25        SEND_VAR                                                 !1
         26        DO_ICALL                                                 
         27      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.81 ms | 1007 KiB | 15 Q