3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array( 0 => "556878", 1 => "12345", 2 => "12345", 3 => "234567", 4 => "45673", 5 => "45673" ); function getNtimes($array,$count){ $finalArray = []; $repeatedValuesCountArray = array_count_values($array); foreach($repeatedValuesCountArray as $key=>$value){ if($value == $count){ $finalArray[] = $key; } } return $finalArray; } print_r(getNtimes($array,2));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/g846e
function name:  (null)
number of ops:  9
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   26     1        INIT_FCALL                                               'print_r'
          2        INIT_FCALL                                               'getntimes'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 2
          5        DO_FCALL                                      0  $2      
          6        SEND_VAR                                                 $2
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Function getntimes:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 15
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 15
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 14
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/g846e
function name:  getNtimes
number of ops:  18
compiled vars:  !0 = $array, !1 = $count, !2 = $finalArray, !3 = $repeatedValuesCountArray, !4 = $value, !5 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   13     2        ASSIGN                                                   !2, <array>
   15     3        INIT_FCALL                                               'array_count_values'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $7      
          6        ASSIGN                                                   !3, $7
   16     7      > FE_RESET_R                                       $9      !3, ->15
          8    > > FE_FETCH_R                                       ~10     $9, !4, ->15
          9    >   ASSIGN                                                   !5, ~10
   17    10        IS_EQUAL                                                 !4, !1
         11      > JMPZ                                                     ~12, ->14
   18    12    >   ASSIGN_DIM                                               !2
         13        OP_DATA                                                  !5
   16    14    > > JMP                                                      ->8
         15    >   FE_FREE                                                  $9
   22    16      > RETURN                                                   !2
   23    17*     > RETURN                                                   null

End of function getntimes

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.63 ms | 1004 KiB | 16 Q