3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 1 => ['Name' => 'John', 'Age' => '20', 'Code' => 'ABC 12'], 2 => ['Name' => 'John', 'Age' => '21', 'Code' => 'ABC 1'], 3 => ['Name' => 'Mary', 'Age' => '20', 'Code' => 'ABC 10'], 4 => ['Name' => 'John', 'Age' => '20', 'Code' => 'ABC 1'], 5 => ['Name' => 'John', 'Age' => '20', 'Code' => 'ABC 100'], 6 => ['Name' => 'John', 'Age' => '20', 'Code' => 'ABC 2'], ]; uasort( $array, fn($a, $b) => [$a['Name'], $b['Age']] <=> [$b['Name'], $a['Age']] // name (ASC) then by age (DESC) ?: strnatcasecmp($a['Code'], $b['Code']) // then by code (ASC / naturally) ); var_export($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AR718
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>
   13     1        INIT_FCALL                                               'uasort'
   14     2        SEND_REF                                                 !0
   15     3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FAR718%3A15%240'
   18     4        SEND_VAL                                                 ~2
          5        DO_ICALL                                                 
   19     6        INIT_FCALL                                               'var_export'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FAR718%3A15%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AR718
function name:  {closure}
number of ops:  21
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   16     2        FETCH_DIM_R                                      ~2      !0, 'Name'
          3        INIT_ARRAY                                       ~3      ~2
          4        FETCH_DIM_R                                      ~4      !1, 'Age'
          5        ADD_ARRAY_ELEMENT                                ~3      ~4
          6        FETCH_DIM_R                                      ~5      !1, 'Name'
          7        INIT_ARRAY                                       ~6      ~5
          8        FETCH_DIM_R                                      ~7      !0, 'Age'
          9        ADD_ARRAY_ELEMENT                                ~6      ~7
         10        SPACESHIP                                        ~8      ~3, ~6
         11        JMP_SET                                          ~9      ~8, ->19
   17    12        INIT_FCALL                                               'strnatcasecmp'
         13        FETCH_DIM_R                                      ~10     !0, 'Code'
         14        SEND_VAL                                                 ~10
         15        FETCH_DIM_R                                      ~11     !1, 'Code'
         16        SEND_VAL                                                 ~11
         17        DO_ICALL                                         $12     
         18        QM_ASSIGN                                        ~9      $12
         19      > RETURN                                                   ~9
   18    20*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FAR718%3A15%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
130.06 ms | 1401 KiB | 19 Q