3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array( array ( "name"=> "apples", "position"=> "1", "basket"=> "2", ), array( "name"=> "potatoes", "position"=> "2", "basket"=> "1", ), array( "name"=> "onions", "position"=> "1", "basket"=> "1", ), array( "name"=> "oranges", "position"=> "3", "basket"=> "2", ), array( "name"=> "tomatoes", "position"=> "4", "basket"=> "1" ), array( "name"=> "grapes", "position"=> "5", "basket"=> "2", ), array( "name"=> "avocado", "position"=> "2", "basket"=> "2", ), array( "name"=> "bean", "position"=> "5", "basket"=> "1", ), array( "name"=> "pineapple", "position"=> "4", "basket"=> "2", ), array( "name"=> "pepper", "position"=> "3", "basket"=> "1", ), ); uasort($array, function($a,$b) { return $a['basket'] - $b['basket'] ?: $a['position'] - $b['position']; }); print_r($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/p9DSP
function name:  (null)
number of ops:  10
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   64     1        INIT_FCALL                                               'uasort'
          2        SEND_REF                                                 !0
          3        DECLARE_LAMBDA_FUNCTION                          ~2      [0]
   67     4        SEND_VAL                                                 ~2
   64     5        DO_ICALL                                                 
   68     6        INIT_FCALL                                               'print_r'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
          9      > 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/p9DSP
function name:  {closure}
number of ops:  12
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   64     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   66     2        FETCH_DIM_R                                      ~2      !0, 'basket'
          3        FETCH_DIM_R                                      ~3      !1, 'basket'
          4        SUB                                              ~4      ~2, ~3
          5        JMP_SET                                          ~5      ~4, ->10
          6        FETCH_DIM_R                                      ~6      !0, 'position'
          7        FETCH_DIM_R                                      ~7      !1, 'position'
          8        SUB                                              ~8      ~6, ~7
          9        QM_ASSIGN                                        ~5      ~8
         10      > RETURN                                                   ~5
   67    11*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.8 ms | 1006 KiB | 15 Q