3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 'field_bathrooms' => 'Bathrooms', 'field_bedrooms' => 'Bedrooms', 'field_king_beds' => 'King Beds', 'field_kitchen' => 'Kitchen', 'field_queen_beds' => 'Queen Beds', 'field_sleeps_max' => 'Sleeps', 'field_sofa_beds' => 'Sofa Beds', 'field_sqft' => 'Square Footage', 'field_twin_beds' => 'Twin Beds', ]; $order = [ 'Bathrooms', 'Square Footage', 'King Beds', 'Sofa Beds', 'Sleeps', 'Twin Beds', 'Queen Beds', 'Kitchen', 'Bedrooms', ]; $order = array_flip($order); array_multisort( array_map(fn($v) => $order[$v], $array), $array ); var_export($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/15Rg8
function name:  (null)
number of ops:  20
compiled vars:  !0 = $array, !1 = $order
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   15     1        ASSIGN                                                   !1, <array>
   27     2        INIT_FCALL                                               'array_flip'
          3        SEND_VAR                                                 !1
          4        DO_ICALL                                         $4      
          5        ASSIGN                                                   !1, $4
   28     6        INIT_FCALL                                               'array_multisort'
   29     7        INIT_FCALL                                               'array_map'
          8        DECLARE_LAMBDA_FUNCTION                          ~6      [0]
          9        BIND_LEXICAL                                             ~6, !1
         10        SEND_VAL                                                 ~6
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                         $7      
         13        SEND_VAL                                                 $7
   30    14        SEND_REF                                                 !0
   28    15        DO_ICALL                                                 
   32    16        INIT_FCALL                                               'var_export'
         17        SEND_VAR                                                 !0
         18        DO_ICALL                                                 
         19      > 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/15Rg8
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $v, !1 = $order
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
129 ms | 1001 KiB | 17 Q