3v4l.org

run code in 500+ PHP versions simultaneously
<?php $name_arr = array('raj','raj','ganesh','rahul','ganesh','mayur','raj','rahul'); $valueCount = array_count_values($name_arr); $final_arr = $name_arr; usort($final_arr, function ($a, $b) use ($valueCount) { return $valueCount[$b] - $valueCount[$a]; }); var_dump($final_arr);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4LXVc
function name:  (null)
number of ops:  16
compiled vars:  !0 = $name_arr, !1 = $valueCount, !2 = $final_arr
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                                             $4      
          4        ASSIGN                                                       !1, $4
    7     5        ASSIGN                                                       !2, !0
    9     6        INIT_FCALL                                                   'usort'
          7        SEND_REF                                                     !2
          8        DECLARE_LAMBDA_FUNCTION                              ~7      [0]
          9        BIND_LEXICAL                                                 ~7, !1
   11    10        SEND_VAL                                                     ~7
    9    11        DO_ICALL                                                     
   13    12        INIT_FCALL                                                   'var_dump'
         13        SEND_VAR                                                     !2
         14        DO_ICALL                                                     
         15      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4LXVc
function name:  {closure:/in/4LXVc:9}
number of ops:  8
compiled vars:  !0 = $a, !1 = $b, !2 = $valueCount
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        BIND_STATIC                                                  !2
   10     3        FETCH_DIM_R                                          ~3      !2, !1
          4        FETCH_DIM_R                                          ~4      !2, !0
          5        SUB                                                  ~5      ~3, ~4
          6      > RETURN                                                       ~5
   11     7*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
232.95 ms | 3423 KiB | 16 Q