3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = [ [6,3,9], [9,1,6], [4,7,9] ]; echo "input array: "; print_r($input); $sort_keys = $input[0]; asort($sort_keys); $sorted = array_map(function($row) use ($sort_keys){ foreach ($sort_keys as $key => $value) { $result[] = $row[$key]; } return $result; }, $input); echo "sorted array: "; print_r($sorted);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ClZRo
function name:  (null)
number of ops:  22
compiled vars:  !0 = $input, !1 = $sort_keys, !2 = $sorted
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    9     1        ECHO                                                     'input+array%3A+'
   10     2        INIT_FCALL                                               'print_r'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                                 
   12     5        FETCH_DIM_R                                      ~5      !0, 0
          6        ASSIGN                                                   !1, ~5
   13     7        INIT_FCALL                                               'asort'
          8        SEND_REF                                                 !1
          9        DO_ICALL                                                 
   15    10        INIT_FCALL                                               'array_map'
         11        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FClZRo%3A15%240'
         12        BIND_LEXICAL                                             ~8, !1
   20    13        SEND_VAL                                                 ~8
         14        SEND_VAR                                                 !0
         15        DO_ICALL                                         $9      
   15    16        ASSIGN                                                   !2, $9
   22    17        ECHO                                                     'sorted+array%3A+'
   23    18        INIT_FCALL                                               'print_r'
         19        SEND_VAR                                                 !2
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FClZRo%3A15%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 9
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/ClZRo
function name:  {closure}
number of ops:  12
compiled vars:  !0 = $row, !1 = $sort_keys, !2 = $value, !3 = $key, !4 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   16     2      > FE_RESET_R                                       $5      !1, ->9
          3    > > FE_FETCH_R                                       ~6      $5, !2, ->9
          4    >   ASSIGN                                                   !3, ~6
   17     5        FETCH_DIM_R                                      ~9      !0, !3
          6        ASSIGN_DIM                                               !4
          7        OP_DATA                                                  ~9
   16     8      > JMP                                                      ->3
          9    >   FE_FREE                                                  $5
   19    10      > RETURN                                                   !4
   20    11*     > RETURN                                                   null

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
182.43 ms | 1396 KiB | 19 Q