3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array = ['a', 'b', 'c', 'c', 'c', 'd', 'a', 'b', 'b', 'b', 'b']; $counts = array_count_values($array); arsort($counts); usort($array, fn($a, $b) => $counts[$b] <=> $counts[$a]); var_export($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rg88e
function name:  (null)
number of ops:  18
compiled vars:  !0 = $array, !1 = $counts
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                                             $3      
          4        ASSIGN                                                       !1, $3
    6     5        INIT_FCALL                                                   'arsort'
          6        SEND_REF                                                     !1
          7        DO_ICALL                                                     
    7     8        INIT_FCALL                                                   'usort'
          9        SEND_REF                                                     !0
         10        DECLARE_LAMBDA_FUNCTION                              ~6      [0]
         11        BIND_LEXICAL                                                 ~6, !1
         12        SEND_VAL                                                     ~6
         13        DO_ICALL                                                     
    8    14        INIT_FCALL                                                   'var_export'
         15        SEND_VAR                                                     !0
         16        DO_ICALL                                                     
         17      > 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/rg88e
function name:  {closure:/in/rg88e:7}
number of ops:  8
compiled vars:  !0 = $a, !1 = $b, !2 = $counts
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        BIND_STATIC                                                  !2
          3        FETCH_DIM_R                                          ~3      !2, !1
          4        FETCH_DIM_R                                          ~4      !2, !0
          5        SPACESHIP                                            ~5      ~3, ~4
          6      > RETURN                                                       ~5
          7*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
159.55 ms | 1928 KiB | 17 Q