3v4l.org

run code in 300+ PHP versions simultaneously
<?php $Test = array( array("a"=>"004", "n"=>"03"), array("a"=>"003", "n"=>"02"), array("a"=>"001", "n"=>"02"), array("a"=>"005", "n"=>"01"), array("a"=>"001", "n"=>"01"), array("a"=>"004", "n"=>"02"), array("a"=>"003", "n"=>"01"), array("a"=>"004", "n"=>"01") ); $orderBy = ['a', 'n']; usort($Test, function($a, $b) use ($orderBy) { return array_map(function($v) use ($a){ return $a[$v]; }, $orderBy) <=> array_map(function($v) use ($b){ return $b[$v]; }, $orderBy); }); var_export($Test);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5ZJOH
function name:  (null)
number of ops:  12
compiled vars:  !0 = $Test, !1 = $orderBy
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   14     1        ASSIGN                                                   !1, <array>
   15     2        INIT_FCALL                                               'usort'
          3        SEND_REF                                                 !0
          4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F5ZJOH%3A15%240'
          5        BIND_LEXICAL                                             ~4, !1
   24     6        SEND_VAL                                                 ~4
          7        DO_ICALL                                                 
   25     8        INIT_FCALL                                               'var_export'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F5ZJOH%3A15%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5ZJOH
function name:  {closure}
number of ops:  18
compiled vars:  !0 = $a, !1 = $b, !2 = $orderBy
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
   17     3        INIT_FCALL                                               'array_map'
          4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F5ZJOH%3A17%241'
          5        BIND_LEXICAL                                             ~3, !0
   19     6        SEND_VAL                                                 ~3
          7        SEND_VAR                                                 !2
          8        DO_ICALL                                         $4      
   21     9        INIT_FCALL                                               'array_map'
         10        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F5ZJOH%3A21%242'
         11        BIND_LEXICAL                                             ~5, !1
   23    12        SEND_VAL                                                 ~5
         13        SEND_VAR                                                 !2
         14        DO_ICALL                                         $6      
         15        SPACESHIP                                        ~7      $4, $6
         16      > RETURN                                                   ~7
   24    17*     > RETURN                                                   null

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

Function %00%7Bclosure%7D%2Fin%2F5ZJOH%3A17%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5ZJOH
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $v, !1 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   18     2        FETCH_DIM_R                                      ~2      !1, !0
          3      > RETURN                                                   ~2
   19     4*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F5ZJOH%3A17%241

Function %00%7Bclosure%7D%2Fin%2F5ZJOH%3A21%242:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5ZJOH
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $v, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   22     2        FETCH_DIM_R                                      ~2      !1, !0
          3      > RETURN                                                   ~2
   23     4*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F5ZJOH%3A21%242

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.12 ms | 1400 KiB | 19 Q