3v4l.org

run code in 500+ 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                              ~4      [0]
          5        BIND_LEXICAL                                                 ~4, !1
   24     6        SEND_VAL                                                     ~4
   15     7        DO_ICALL                                                     
   25     8        INIT_FCALL                                                   'var_export'
          9        SEND_VAR                                                     !0
         10        DO_ICALL                                                     
         11      > 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/5ZJOH
function name:  {closure:/in/5ZJOH:15}
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                              ~3      [0]
          5        BIND_LEXICAL                                                 ~3, !0
   19     6        SEND_VAL                                                     ~3
          7        SEND_VAR                                                     !2
   17     8        DO_ICALL                                             $4      
   21     9        INIT_FCALL                                                   'array_map'
         10        DECLARE_LAMBDA_FUNCTION                              ~5      [1]
         11        BIND_LEXICAL                                                 ~5, !1
   23    12        SEND_VAL                                                     ~5
         13        SEND_VAR                                                     !2
   21    14        DO_ICALL                                             $6      
   23    15        SPACESHIP                                            ~7      $4, $6
         16      > RETURN                                                       ~7
   24    17*     > RETURN                                                       null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5ZJOH
function name:  {closure:{closure:/in/5ZJOH:15}:17}
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 Dynamic Function 0

Dynamic Function 1
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5ZJOH
function name:  {closure:{closure:/in/5ZJOH:15}:21}
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 Dynamic Function 1

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
165.69 ms | 3464 KiB | 16 Q