3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array = ['a', 'e', 'b', 'c', 'c', 'c', 'e', 'd', 'a', 'b', 'b', 'b', 'b', 'e']; $counts = array_count_values($array); arsort($counts); usort($array, fn($a, $b) => [$counts[$b], $a] <=> [$counts[$a], $b]); var_export($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sHokG
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/sHokG
function name:  {closure:/in/sHokG:7}
number of ops:  12
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        INIT_ARRAY                                           ~4      ~3
          5        ADD_ARRAY_ELEMENT                                    ~4      !0
          6        FETCH_DIM_R                                          ~5      !2, !0
          7        INIT_ARRAY                                           ~6      ~5
          8        ADD_ARRAY_ELEMENT                                    ~6      !1
          9        SPACESHIP                                            ~7      ~4, ~6
         10      > RETURN                                                       ~7
         11*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
207.45 ms | 1933 KiB | 17 Q