3v4l.org

run code in 300+ PHP versions simultaneously
<?php $menu = [ (object)[ 'tid' => 24, 'name' => 'Sample', 'weight' => 3, 'depth' => 0 ], (object)[ 'tid' => 66, 'name' => 'Sample Subcategory', 'weight' => 0, 'depth' => 1 ], (object)[ 'tid' => 67, 'name' => 'Another Example', 'weight' => 1, 'depth' => 0 ], (object)[ 'tid' => 68, 'name' => 'Subcategory for Another Example', 'weight' => 1, 'depth' => 1 ], (object)[ 'tid' => 22, 'name' => 'A third example master category', 'weight' => 0, 'depth' => 0 ] ]; usort($menu, function($a, $b) { return [$a->depth, $a->weight] <=> [$b->depth, $b->weight]; }); var_export($menu);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/X7dG9
function name:  (null)
number of ops:  20
compiled vars:  !0 = $menu
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   CAST                                          8  ~1      <array>
          1        INIT_ARRAY                                       ~2      ~1
   11     2        CAST                                          8  ~3      <array>
          3        ADD_ARRAY_ELEMENT                                ~2      ~3
   17     4        CAST                                          8  ~4      <array>
          5        ADD_ARRAY_ELEMENT                                ~2      ~4
   23     6        CAST                                          8  ~5      <array>
          7        ADD_ARRAY_ELEMENT                                ~2      ~5
   29     8        CAST                                          8  ~6      <array>
          9        ADD_ARRAY_ELEMENT                                ~2      ~6
    3    10        ASSIGN                                                   !0, ~2
   36    11        INIT_FCALL                                               'usort'
         12        SEND_REF                                                 !0
         13        DECLARE_LAMBDA_FUNCTION                          ~8      [0]
   38    14        SEND_VAL                                                 ~8
   36    15        DO_ICALL                                                 
   39    16        INIT_FCALL                                               'var_export'
         17        SEND_VAR                                                 !0
         18        DO_ICALL                                                 
         19      > 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/X7dG9
function name:  {closure}
number of ops:  13
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   36     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   37     2        FETCH_OBJ_R                                      ~2      !0, 'depth'
          3        INIT_ARRAY                                       ~3      ~2
          4        FETCH_OBJ_R                                      ~4      !0, 'weight'
          5        ADD_ARRAY_ELEMENT                                ~3      ~4
          6        FETCH_OBJ_R                                      ~5      !1, 'depth'
          7        INIT_ARRAY                                       ~6      ~5
          8        FETCH_OBJ_R                                      ~7      !1, 'weight'
          9        ADD_ARRAY_ELEMENT                                ~6      ~7
         10        SPACESHIP                                        ~8      ~3, ~6
         11      > RETURN                                                   ~8
   38    12*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.12 ms | 1015 KiB | 15 Q