3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 'a' => 0, 'b' => 0, 'c' => 0, 'd' => 1, 'e' => 1, 'f' => 1 ]; $array = [1,0,0,0,0,1,1,0,0,0,0,0,0]; $counters = [0, 0]; $nths = []; foreach ($array as $v) { $nths[] = $counters[$v]++; } array_multisort($nths, $array, SORT_DESC); var_export($array);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 11
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 11
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
filename:       /in/lD2BX
function name:  (null)
number of ops:  21
compiled vars:  !0 = $array, !1 = $counters, !2 = $nths, !3 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   11     1        ASSIGN                                                   !0, <array>
   13     2        ASSIGN                                                   !1, <array>
   14     3        ASSIGN                                                   !2, <array>
   15     4      > FE_RESET_R                                       $8      !0, ->11
          5    > > FE_FETCH_R                                               $8, !3, ->11
   16     6    >   FETCH_DIM_RW                                     $10     !1, !3
          7        POST_INC                                         ~11     $10
          8        ASSIGN_DIM                                               !2
          9        OP_DATA                                                  ~11
   15    10      > JMP                                                      ->5
         11    >   FE_FREE                                                  $8
   19    12        INIT_FCALL                                               'array_multisort'
         13        SEND_REF                                                 !2
         14        SEND_REF                                                 !0
         15        SEND_VAL                                                 3
         16        DO_ICALL                                                 
   20    17        INIT_FCALL                                               'var_export'
         18        SEND_VAR                                                 !0
         19        DO_ICALL                                                 
         20      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.34 ms | 1002 KiB | 15 Q