3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = [ [ 'first_name' => 'GM', 'middle_name' => null, 'last_name' => 'Akbari', 'guest_booking' =>[ [ 'booking_number' => 20008683, 'ship_code' => 'OST', 'room_no' => 'A0073', 'start_time' => 1438214400, 'end_time' => 1483142400, 'is_checked_in' => true, ] ], 'guest_account' => [ [ 'account_id' => 20009503, 'status_id' => 2, 'account_limit' => 0, 'allow_charges' => true, ] ] ], [ 'first_name' => 'Alex ', 'middle_name' => null, 'last_name' => 'Marvi', 'guest_booking' => [ [ 'booking_number' => 10000013, 'room_no' => 'B0092', 'is_checked_in' => true, ], ], 'guest_account' => [ [ 'account_id' => 10000500, 'account_limit' => 300, 'allow_charges' => true, ], ], ], ]; function sortMyArray(array &$array, $target_key) { $columnValues = []; array_walk_recursive( $array, function($v, $k, $key) use (&$columnValues) { if ($k === $key) { $columnValues[] = $v; } }, $target_key ); array_multisort($columnValues, $array); } sortMyArray($data, 'account_id'); var_export($data);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aVelD
function name:  (null)
number of ops:  9
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   63     1        INIT_FCALL                                               'sortmyarray'
          2        SEND_REF                                                 !0
          3        SEND_VAL                                                 'account_id'
          4        DO_FCALL                                      0          
   64     5        INIT_FCALL                                               'var_export'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Function sortmyarray:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aVelD
function name:  sortMyArray
number of ops:  15
compiled vars:  !0 = $array, !1 = $target_key, !2 = $columnValues
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   49     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   50     2        ASSIGN                                                   !2, <array>
   51     3        INIT_FCALL                                               'array_walk_recursive'
   52     4        SEND_REF                                                 !0
   53     5        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FaVelD%3A53%240'
          6        BIND_LEXICAL                                             ~4, !2
   57     7        SEND_VAL                                                 ~4
   58     8        SEND_VAR                                                 !1
          9        DO_ICALL                                                 
   60    10        INIT_FCALL                                               'array_multisort'
         11        SEND_REF                                                 !2
         12        SEND_REF                                                 !0
         13        DO_ICALL                                                 
   61    14      > RETURN                                                   null

End of function sortmyarray

Function %00%7Bclosure%7D%2Fin%2FaVelD%3A53%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/aVelD
function name:  {closure}
number of ops:  9
compiled vars:  !0 = $v, !1 = $k, !2 = $key, !3 = $columnValues
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   53     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        BIND_STATIC                                              !3
   54     4        IS_IDENTICAL                                             !1, !2
          5      > JMPZ                                                     ~4, ->8
   55     6    >   ASSIGN_DIM                                               !3
          7        OP_DATA                                                  !0
   57     8    > > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FaVelD%3A53%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.59 ms | 1407 KiB | 20 Q