3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 'foo', 'foo', 'bar', 'foo', 'bar', 'foo', 'foo', 'bar' ]; $values = array_count_values($array); usort($array, function($a, $b) use ($values) {return $values[$b]-$values[$a];} ); var_dump($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XKr1F
function name:  (null)
number of ops:  15
compiled vars:  !0 = $array, !1 = $values
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   13     1        INIT_FCALL                                               'array_count_values'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !1, $3
   14     5        INIT_FCALL                                               'usort'
          6        SEND_REF                                                 !0
          7        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FXKr1F%3A14%240'
          8        BIND_LEXICAL                                             ~5, !1
          9        SEND_VAL                                                 ~5
         10        DO_ICALL                                                 
   15    11        INIT_FCALL                                               'var_dump'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                                 
         14      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FXKr1F%3A14%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XKr1F
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $a, !1 = $b, !2 = $values
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     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        SUB                                              ~5      ~3, ~4
          6      > RETURN                                                   ~5
          7*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FXKr1F%3A14%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.66 ms | 1400 KiB | 19 Q