3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array( "0" => "red", "1" => "green" , "2" => "red" , "3" => "blue", "4" => "blue", "5" => "blue" ); $group_by_data = array_count_values($a); $keys = []; foreach($a as $key => $color){ if($group_by_data[$color] > 1){ if(!isset($keys[$color])) $keys[$color] = []; $keys[$color][] = $key; } } print_r($keys);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 21
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 21
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 20
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 17
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 17
Branch analysis from position: 20
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/mI02u
function name:  (null)
number of ops:  26
compiled vars:  !0 = $a, !1 = $group_by_data, !2 = $keys, !3 = $color, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        INIT_FCALL                                               'array_count_values'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $6      
          4        ASSIGN                                                   !1, $6
    7     5        ASSIGN                                                   !2, <array>
    9     6      > FE_RESET_R                                       $9      !0, ->21
          7    > > FE_FETCH_R                                       ~10     $9, !3, ->21
          8    >   ASSIGN                                                   !4, ~10
   10     9        FETCH_DIM_R                                      ~12     !1, !3
         10        IS_SMALLER                                               1, ~12
         11      > JMPZ                                                     ~13, ->20
   11    12    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~14     !2, !3
         13        BOOL_NOT                                         ~15     ~14
         14      > JMPZ                                                     ~15, ->17
         15    >   ASSIGN_DIM                                               !2, !3
         16        OP_DATA                                                  <array>
   12    17    >   FETCH_DIM_W                                      $17     !2, !3
         18        ASSIGN_DIM                                               $17
         19        OP_DATA                                                  !4
    9    20    > > JMP                                                      ->7
         21    >   FE_FREE                                                  $9
   17    22        INIT_FCALL                                               'print_r'
         23        SEND_VAR                                                 !2
         24        DO_ICALL                                                 
         25      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.43 ms | 1002 KiB | 15 Q