3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ['title' => 'foo', 'catid' => 1], ['title' => 'fi', 'catid' => 1], ['title' => 'bar', 'catid' => 2], ['title' => 'fum', 'catid' => 1], ['title' => 'blah', 'catid' => 3], ['title' => 'barn', 'catid' => 2], ['title' => 'bark', 'catid' => 2], ['title' => 'fa', 'catid' => 1], ]; $encounters = []; $catIds = []; foreach ($array as ['catid' => $v]) { $catIds[] = $v; $encounters[] = $e[$v] = ($e[$v] ?? 0) + 1; } array_multisort($encounters, $catIds, $array); var_export($array);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 19
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 19
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/ktprb
function name:  (null)
number of ops:  29
compiled vars:  !0 = $array, !1 = $encounters, !2 = $catIds, !3 = $v, !4 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   14     1        ASSIGN                                                   !1, <array>
   15     2        ASSIGN                                                   !2, <array>
   16     3      > FE_RESET_R                                       $8      !0, ->19
          4    > > FE_FETCH_R                                               $8, $9, ->19
          5    >   FETCH_LIST_R                                     $10     $9, 'catid'
          6        ASSIGN                                                   !3, $10
          7        FREE                                                     $9
   17     8        ASSIGN_DIM                                               !2
          9        OP_DATA                                                  !3
   18    10        FETCH_DIM_IS                                     ~15     !4, !3
         11        COALESCE                                         ~16     ~15
         12        QM_ASSIGN                                        ~16     0
         13        ADD                                              ~17     ~16, 1
         14        ASSIGN_DIM                                       ~14     !4, !3
         15        OP_DATA                                                  ~17
         16        ASSIGN_DIM                                               !1
         17        OP_DATA                                                  ~14
   16    18      > JMP                                                      ->4
         19    >   FE_FREE                                                  $8
   21    20        INIT_FCALL                                               'array_multisort'
         21        SEND_REF                                                 !1
         22        SEND_REF                                                 !2
         23        SEND_REF                                                 !0
         24        DO_ICALL                                                 
   22    25        INIT_FCALL                                               'var_export'
         26        SEND_VAR                                                 !0
         27        DO_ICALL                                                 
         28      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.41 ms | 1007 KiB | 15 Q