3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array(45, 5, 1, 22, 22, 10, 10); //use array_count_values to counts all the values of an array. $get_repeated_value = array_count_values($array); $final_array = array(); foreach($get_repeated_value as $key => $value){ //If value is repeated, get the index of that values from array. if($value > 1){ $final_array[$key] = array_keys($array, $key); } } echo "<pre>"; print_r($final_array); ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 18
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 18
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 17
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 17
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/I9QIe
function name:  (null)
number of ops:  24
compiled vars:  !0 = $array, !1 = $get_repeated_value, !2 = $final_array, !3 = $value, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     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>
    8     6      > FE_RESET_R                                       $9      !1, ->18
          7    > > FE_FETCH_R                                       ~10     $9, !3, ->18
          8    >   ASSIGN                                                   !4, ~10
   11     9        IS_SMALLER                                               1, !3
         10      > JMPZ                                                     ~12, ->17
   12    11    >   INIT_FCALL                                               'array_keys'
         12        SEND_VAR                                                 !0
         13        SEND_VAR                                                 !4
         14        DO_ICALL                                         $14     
         15        ASSIGN_DIM                                               !2, !4
         16        OP_DATA                                                  $14
    8    17    > > JMP                                                      ->7
         18    >   FE_FREE                                                  $9
   17    19        ECHO                                                     '%3Cpre%3E'
   18    20        INIT_FCALL                                               'print_r'
         21        SEND_VAR                                                 !2
         22        DO_ICALL                                                 
   20    23      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.6 ms | 1002 KiB | 16 Q