3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ 0 => "556878", 1 => "12345", 2 => "12345", 3 => "234567", 4 => "45673", 5 => "45673", ]; function getNtimes($arr, $n) { $temp = array_count_values($arr); return array_keys(array_filter($temp, function ($value) use (&$n) { return $value == $n; })); } $arr = getNtimes($arr, 2); print_r($arr);die;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/02aTb
function name:  (null)
number of ops:  11
compiled vars:  !0 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   17     1        INIT_FCALL                                               'getntimes'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 2
          4        DO_FCALL                                      0  $2      
          5        ASSIGN                                                   !0, $2
   18     6        INIT_FCALL                                               'print_r'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
          9      > EXIT                                                     
   19    10*     > RETURN                                                   1

Function getntimes:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/02aTb
function name:  getNtimes
number of ops:  17
compiled vars:  !0 = $arr, !1 = $n, !2 = $temp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   12     2        INIT_FCALL                                               'array_count_values'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $3      
          5        ASSIGN                                                   !2, $3
   13     6        INIT_FCALL                                               'array_keys'
          7        INIT_FCALL                                               'array_filter'
          8        SEND_VAR                                                 !2
          9        DECLARE_LAMBDA_FUNCTION                          ~5      [0]
         10        BIND_LEXICAL                                             ~5, !1
   15    11        SEND_VAL                                                 ~5
   13    12        DO_ICALL                                         $6      
   15    13        SEND_VAR                                                 $6
   13    14        DO_ICALL                                         $7      
   15    15      > RETURN                                                   $7
   16    16*     > RETURN                                                   null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/02aTb
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $value, !1 = $n
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   14     2        IS_EQUAL                                         ~2      !0, !1
          3      > RETURN                                                   ~2
   15     4*     > RETURN                                                   null

End of Dynamic Function 0

End of function getntimes

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.01 ms | 1006 KiB | 18 Q