3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = [ 0 => [ 'SMITH1', 'SMITH2', 'SMITH3', 'SMITH4', ], 1 =>[ 'JOHN1', 'JOHN2', 'JOHN3', 'JOHN4', ] ]; $newArr = []; foreach ($data[0] as $k=>$v){ $newArr[] = [ 'fname' => $v, 'lname' => $data[1][$k] ]; unset($data[0][$k]); unset($data[1][$k]); } array_multisort( array_column($newArr, 'fname'), SORT_ASC, array_column($newArr, 'lname'), SORT_ASC, $newArr ); print_r($newArr);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 17
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 17
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/YnA1g
function name:  (null)
number of ops:  37
compiled vars:  !0 = $data, !1 = $newArr, !2 = $v, !3 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   17     1        ASSIGN                                                   !1, <array>
   18     2        FETCH_DIM_R                                      ~6      !0, 0
          3      > FE_RESET_R                                       $7      ~6, ->17
          4    > > FE_FETCH_R                                       ~8      $7, !2, ->17
          5    >   ASSIGN                                                   !3, ~8
   20     6        INIT_ARRAY                                       ~11     !2, 'fname'
   21     7        FETCH_DIM_R                                      ~12     !0, 1
          8        FETCH_DIM_R                                      ~13     ~12, !3
          9        ADD_ARRAY_ELEMENT                                ~11     ~13, 'lname'
   19    10        ASSIGN_DIM                                               !1
   21    11        OP_DATA                                                  ~11
   23    12        FETCH_DIM_UNSET                                  $14     !0, 0
         13        UNSET_DIM                                                $14, !3
   24    14        FETCH_DIM_UNSET                                  $15     !0, 1
         15        UNSET_DIM                                                $15, !3
   18    16      > JMP                                                      ->4
         17    >   FE_FREE                                                  $7
   26    18        INIT_FCALL                                               'array_multisort'
   27    19        INIT_FCALL                                               'array_column'
         20        SEND_VAR                                                 !1
         21        SEND_VAL                                                 'fname'
         22        DO_ICALL                                         $16     
         23        SEND_VAL                                                 $16
         24        SEND_VAL                                                 4
   28    25        INIT_FCALL                                               'array_column'
         26        SEND_VAR                                                 !1
         27        SEND_VAL                                                 'lname'
         28        DO_ICALL                                         $17     
         29        SEND_VAL                                                 $17
         30        SEND_VAL                                                 4
   29    31        SEND_REF                                                 !1
         32        DO_ICALL                                                 
   32    33        INIT_FCALL                                               'print_r'
         34        SEND_VAR                                                 !1
         35        DO_ICALL                                                 
         36      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.83 ms | 1396 KiB | 19 Q