3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [1, 1, 2, 3, 4, 5, 6, 7, 9, 9, 10]; $result = []; foreach ($array as $index => $value) { if (!isset($result[$value])) { $result[$value] = $index; } else { $result[$value] .= ",$index"; } } var_export(array_values($result));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 16
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 16
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 11
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/rT9kke
function name:  (null)
number of ops:  24
compiled vars:  !0 = $array, !1 = $result, !2 = $value, !3 = $index
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        ASSIGN                                                   !1, <array>
    6     2      > FE_RESET_R                                       $6      !0, ->16
          3    > > FE_FETCH_R                                       ~7      $6, !2, ->16
          4    >   ASSIGN                                                   !3, ~7
    7     5        ISSET_ISEMPTY_DIM_OBJ                         0  ~9      !1, !2
          6        BOOL_NOT                                         ~10     ~9
          7      > JMPZ                                                     ~10, ->11
    8     8    >   ASSIGN_DIM                                               !1, !2
          9        OP_DATA                                                  !3
    7    10      > JMP                                                      ->15
   10    11    >   NOP                                                      
         12        FAST_CONCAT                                      ~13     '%2C', !3
         13        ASSIGN_DIM_OP                .=               8          !1, !2
         14        OP_DATA                                                  ~13
    6    15    > > JMP                                                      ->3
         16    >   FE_FREE                                                  $6
   13    17        INIT_FCALL                                               'var_export'
         18        INIT_FCALL                                               'array_values'
         19        SEND_VAR                                                 !1
         20        DO_ICALL                                         $14     
         21        SEND_VAR                                                 $14
         22        DO_ICALL                                                 
         23      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.9 ms | 1001 KiB | 15 Q