3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr1 = ["101","206", "206"]; $arr2 = ["PA701", "PA700", "PA700"]; $arr3 = ["2022-04-01", "2022-04-07", "2022-04-07"]; $arr4 = [70, 1040, 1625]; foreach ($arr1 as $i => $value) { $compositeKey = "{$value}_{$arr2[$i]}_{$arr3[$i]}"; if (!isset($res1[$compositeKey])) { $res1[$compositeKey] = $value; $res2[$compositeKey] = $arr2[$i]; $res3[$compositeKey] = $arr3[$i]; $res4[$compositeKey] = $arr4[$i]; } else { $res4[$compositeKey] += $arr4[$i]; } } var_export(array_values($res1)); var_export(array_values($res2)); var_export(array_values($res3)); var_export(array_values($res4));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 34
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 34
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 30
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
filename:       /in/KAR6k
function name:  (null)
number of ops:  60
compiled vars:  !0 = $arr1, !1 = $arr2, !2 = $arr3, !3 = $arr4, !4 = $value, !5 = $i, !6 = $compositeKey, !7 = $res1, !8 = $res2, !9 = $res3, !10 = $res4
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    5     2        ASSIGN                                                   !2, <array>
    6     3        ASSIGN                                                   !3, <array>
    9     4      > FE_RESET_R                                       $15     !0, ->34
          5    > > FE_FETCH_R                                       ~16     $15, !4, ->34
          6    >   ASSIGN                                                   !5, ~16
   10     7        ROPE_INIT                                     5  ~21     !4
          8        ROPE_ADD                                      1  ~21     ~21, '_'
          9        FETCH_DIM_R                                      ~18     !1, !5
         10        ROPE_ADD                                      2  ~21     ~21, ~18
         11        ROPE_ADD                                      3  ~21     ~21, '_'
         12        FETCH_DIM_R                                      ~19     !2, !5
         13        ROPE_END                                      4  ~20     ~21, ~19
         14        ASSIGN                                                   !6, ~20
   11    15        ISSET_ISEMPTY_DIM_OBJ                         0  ~25     !7, !6
         16        BOOL_NOT                                         ~26     ~25
         17      > JMPZ                                                     ~26, ->30
   12    18    >   ASSIGN_DIM                                               !7, !6
         19        OP_DATA                                                  !4
   13    20        FETCH_DIM_R                                      ~29     !1, !5
         21        ASSIGN_DIM                                               !8, !6
         22        OP_DATA                                                  ~29
   14    23        FETCH_DIM_R                                      ~31     !2, !5
         24        ASSIGN_DIM                                               !9, !6
         25        OP_DATA                                                  ~31
   15    26        FETCH_DIM_R                                      ~33     !3, !5
         27        ASSIGN_DIM                                               !10, !6
         28        OP_DATA                                                  ~33
   11    29      > JMP                                                      ->33
   17    30    >   FETCH_DIM_R                                      ~35     !3, !5
         31        ASSIGN_DIM_OP                +=               1          !10, !6
         32        OP_DATA                                                  ~35
    9    33    > > JMP                                                      ->5
         34    >   FE_FREE                                                  $15
   20    35        INIT_FCALL                                               'var_export'
         36        INIT_FCALL                                               'array_values'
         37        SEND_VAR                                                 !7
         38        DO_ICALL                                         $36     
         39        SEND_VAR                                                 $36
         40        DO_ICALL                                                 
   21    41        INIT_FCALL                                               'var_export'
         42        INIT_FCALL                                               'array_values'
         43        SEND_VAR                                                 !8
         44        DO_ICALL                                         $38     
         45        SEND_VAR                                                 $38
         46        DO_ICALL                                                 
   22    47        INIT_FCALL                                               'var_export'
         48        INIT_FCALL                                               'array_values'
         49        SEND_VAR                                                 !9
         50        DO_ICALL                                         $40     
         51        SEND_VAR                                                 $40
         52        DO_ICALL                                                 
   23    53        INIT_FCALL                                               'var_export'
         54        INIT_FCALL                                               'array_values'
         55        SEND_VAR                                                 !10
         56        DO_ICALL                                         $42     
         57        SEND_VAR                                                 $42
         58        DO_ICALL                                                 
         59      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.43 ms | 1004 KiB | 15 Q