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, fn($a, $b) => array_map(fn($v) => $a[$v], $orderBy) <=> array_map(fn($v) => $b[$v], $orderBy) ); var_export($Test);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cQnV9
function name:  (null)
number of ops:  13
compiled vars:  !0 = $Test, !1 = $orderBy, !2 = $v
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                          ~5      [0]
          5        BIND_LEXICAL                                             ~5, !2
          6        BIND_LEXICAL                                             ~5, !1
   19     7        SEND_VAL                                                 ~5
   15     8        DO_ICALL                                                 
   20     9        INIT_FCALL                                               'var_export'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                                 
         12      > 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/cQnV9
function name:  {closure}
number of ops:  19
compiled vars:  !0 = $a, !1 = $b, !2 = $v, !3 = $orderBy
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
          3        BIND_STATIC                                              !3
   16     4        INIT_FCALL                                               'array_map'
          5        DECLARE_LAMBDA_FUNCTION                          ~4      [0]
          6        BIND_LEXICAL                                             ~4, !0
          7        SEND_VAL                                                 ~4
          8        SEND_VAR                                                 !3
          9        DO_ICALL                                         $5      
   18    10        INIT_FCALL                                               'array_map'
         11        DECLARE_LAMBDA_FUNCTION                          ~6      [1]
         12        BIND_LEXICAL                                             ~6, !1
         13        SEND_VAL                                                 ~6
         14        SEND_VAR                                                 !3
         15        DO_ICALL                                         $7      
         16        SPACESHIP                                        ~8      $5, $7
         17      > RETURN                                                   ~8
   19    18*     > 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/cQnV9
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $v, !1 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        FETCH_DIM_R                                      ~2      !1, !0
          3      > RETURN                                                   ~2
          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/cQnV9
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $v, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        FETCH_DIM_R                                      ~2      !1, !0
          3      > RETURN                                                   ~2
          4*     > RETURN                                                   null

End of Dynamic Function 1

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.08 ms | 1009 KiB | 16 Q