3v4l.org

run code in 500+ PHP versions simultaneously
<?php $rows = [ ['ID' => 188, 'zip_code' => 60022, 'approved' => 0], ['ID' => 124, 'zip_code' => 60002, 'approved' => 0], ['ID' => 138, 'zip_code' => 60007, 'approved' => 1], ['ID' => 114, 'zip_code' => 60007, 'approved' => 1], ['ID' => 105, 'zip_code' => 60003, 'approved' => 0], ['ID' => 104, 'zip_code' => 60002, 'approved' => 1], ['ID' => 199, 'zip_code' => 60199, 'approved' => 0], ['ID' => 106, 'zip_code' => 60001, 'approved' => 0], ['ID' => 184, 'zip_code' => 60022, 'approved' => 1], ['ID' => 103, 'zip_code' => 60007, 'approved' => 0], ]; $priorityZips = array_flip([60007, 60001, 60003, 60002]); $priorityCount = count($priorityZips); array_multisort( array_map( function($row) use ($priorityZips, $priorityCount) { return $priorityZips[$row['zip_code']] ?? $priorityCount; }, $rows ), array_column($rows, 'zip_code'), array_column($rows, 'approved'), SORT_DESC, $rows ); var_export($rows);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ps65S
function name:  (null)
number of ops:  33
compiled vars:  !0 = $rows, !1 = $priorityZips, !2 = $priorityCount
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   16     1        INIT_FCALL                                                   'array_flip'
          2        SEND_VAL                                                     <array>
          3        DO_ICALL                                             $4      
          4        ASSIGN                                                       !1, $4
   17     5        COUNT                                                ~6      !1
          6        ASSIGN                                                       !2, ~6
   19     7        INIT_FCALL                                                   'array_multisort'
   20     8        INIT_FCALL                                                   'array_map'
   21     9        DECLARE_LAMBDA_FUNCTION                              ~8      [0]
         10        BIND_LEXICAL                                                 ~8, !1
         11        BIND_LEXICAL                                                 ~8, !2
   23    12        SEND_VAL                                                     ~8
   24    13        SEND_VAR                                                     !0
   20    14        DO_ICALL                                             $9      
   24    15        SEND_VAL                                                     $9
   26    16        INIT_FCALL                                                   'array_column'
         17        SEND_VAR                                                     !0
         18        SEND_VAL                                                     'zip_code'
         19        DO_ICALL                                             $10     
         20        SEND_VAL                                                     $10
   27    21        INIT_FCALL                                                   'array_column'
         22        SEND_VAR                                                     !0
         23        SEND_VAL                                                     'approved'
         24        DO_ICALL                                             $11     
         25        SEND_VAL                                                     $11
   28    26        SEND_VAL                                                     3
   29    27        SEND_REF                                                     !0
   19    28        DO_ICALL                                                     
   31    29        INIT_FCALL                                                   'var_export'
         30        SEND_VAR                                                     !0
         31        DO_ICALL                                                     
         32      > 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/ps65S
function name:  {closure:/in/ps65S:21}
number of ops:  9
compiled vars:  !0 = $row, !1 = $priorityZips, !2 = $priorityCount
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   21     0  E >   RECV                                                 !0      
          1        BIND_STATIC                                                  !1
          2        BIND_STATIC                                                  !2
   22     3        FETCH_DIM_R                                          ~3      !0, 'zip_code'
          4        FETCH_DIM_IS                                         ~4      !1, ~3
          5        COALESCE                                             ~5      ~4
          6        QM_ASSIGN                                            ~5      !2
          7      > RETURN                                                       ~5
   23     8*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
161.68 ms | 2326 KiB | 18 Q