3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ 'itemA' => [ 'product_id' => 1, 'category_id' => 1, ], 'itemB' => [ 'product_id' => 2, 'category_id' => 2, ], 'itemC' => [ 'product_id' => 3, 'category_id' => 1, ], 'itemE' => [ 'product_id' => 4, 'category_id' => 1, ], 'itemD' => [ 'product_id' => 5, 'category_id' => 2, ], ]; uasort($arr, function ($a, $b) { if ($a['category_id'] == $b['category_id']) { return $a['product_id'] - $b['product_id']; } return $a['category_id'] < $b['category_id'] ? -1 : 1; }); var_dump($arr);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OgUSj
function name:  (null)
number of ops:  10
compiled vars:  !0 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   26     1        INIT_FCALL                                               'uasort'
          2        SEND_REF                                                 !0
          3        DECLARE_LAMBDA_FUNCTION                          ~2      [0]
   32     4        SEND_VAL                                                 ~2
   26     5        DO_ICALL                                                 
   34     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
          9      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 10
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OgUSj
function name:  {closure}
number of ops:  19
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   27     2        FETCH_DIM_R                                      ~2      !0, 'category_id'
          3        FETCH_DIM_R                                      ~3      !1, 'category_id'
          4        IS_EQUAL                                                 ~2, ~3
          5      > JMPZ                                                     ~4, ->10
   28     6    >   FETCH_DIM_R                                      ~5      !0, 'product_id'
          7        FETCH_DIM_R                                      ~6      !1, 'product_id'
          8        SUB                                              ~7      ~5, ~6
          9      > RETURN                                                   ~7
   31    10    >   FETCH_DIM_R                                      ~8      !0, 'category_id'
         11        FETCH_DIM_R                                      ~9      !1, 'category_id'
         12        IS_SMALLER                                               ~8, ~9
         13      > JMPZ                                                     ~10, ->16
         14    >   QM_ASSIGN                                        ~11     -1
         15      > JMP                                                      ->17
         16    >   QM_ASSIGN                                        ~11     1
         17    > > RETURN                                                   ~11
   32    18*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.8 ms | 1004 KiB | 15 Q