3v4l.org

run code in 500+ PHP versions simultaneously
<?php $customer['address'] = '123 fake st'; $customer['name'] = 'Tim'; $customer['dob'] = '12/08/1986'; $customer['dontSortMe'] = 'this value doesnt need to be sorted'; $order = array('name', 'dob', 'address'); $keys= array_flip($order); uksort($customer, function($a, $b)use($keys){ return $keys[$a] - $keys[$b]; }); print_r($customer);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Q4osh
function name:  (null)
number of ops:  23
compiled vars:  !0 = $customer, !1 = $order, !2 = $keys
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN_DIM                                                   !0, 'address'
          1        OP_DATA                                                      '123+fake+st'
    4     2        ASSIGN_DIM                                                   !0, 'name'
          3        OP_DATA                                                      'Tim'
    5     4        ASSIGN_DIM                                                   !0, 'dob'
          5        OP_DATA                                                      '12%2F08%2F1986'
    6     6        ASSIGN_DIM                                                   !0, 'dontSortMe'
          7        OP_DATA                                                      'this+value+doesnt+need+to+be+sorted'
    8     8        ASSIGN                                                       !1, <array>
   10     9        INIT_FCALL                                                   'array_flip'
         10        SEND_VAR                                                     !1
         11        DO_ICALL                                             $8      
         12        ASSIGN                                                       !2, $8
   11    13        INIT_FCALL                                                   'uksort'
         14        SEND_REF                                                     !0
         15        DECLARE_LAMBDA_FUNCTION                              ~10     [0]
         16        BIND_LEXICAL                                                 ~10, !2
   13    17        SEND_VAL                                                     ~10
   11    18        DO_ICALL                                                     
   14    19        INIT_FCALL                                                   'print_r'
         20        SEND_VAR                                                     !0
         21        DO_ICALL                                                     
         22      > 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/Q4osh
function name:  {closure:/in/Q4osh:11}
number of ops:  8
compiled vars:  !0 = $a, !1 = $b, !2 = $keys
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        BIND_STATIC                                                  !2
   12     3        FETCH_DIM_R                                          ~3      !2, !0
          4        FETCH_DIM_R                                          ~4      !2, !1
          5        SUB                                                  ~5      ~3, ~4
          6      > RETURN                                                       ~5
   13     7*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
159.81 ms | 1763 KiB | 16 Q