3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array = [ ['id' => '111', 'value' => 'abc'], ['id' => '100', 'value' => 'abc'], ['id' => '132', 'value' => 'abc'], ['id' => '222', 'value' => 'abc'], ['id' => '112', 'value' => 'abc'], ['id' => '200', 'value' => 'abc'] ]; $idPriorities = array_flip(['112', '111', '132', '100']); $idOutlier = count($idPriorities); usort( $array, fn($a, $b) => ($idPriorities[$a['id']] ?? $idOutlier) <=> ($idPriorities[$b['id']] ?? $idOutlier) ); var_export($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/L9Tqr
function name:  (null)
number of ops:  18
compiled vars:  !0 = $array, !1 = $idPriorities, !2 = $idOutlier
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   12     1        INIT_FCALL                                                   'array_flip'
          2        SEND_VAL                                                     <array>
          3        DO_ICALL                                             $4      
          4        ASSIGN                                                       !1, $4
   13     5        COUNT                                                ~6      !1
          6        ASSIGN                                                       !2, ~6
   15     7        INIT_FCALL                                                   'usort'
   16     8        SEND_REF                                                     !0
   17     9        DECLARE_LAMBDA_FUNCTION                              ~8      [0]
         10        BIND_LEXICAL                                                 ~8, !1
         11        BIND_LEXICAL                                                 ~8, !2
   18    12        SEND_VAL                                                     ~8
   15    13        DO_ICALL                                                     
   20    14        INIT_FCALL                                                   'var_export'
         15        SEND_VAR                                                     !0
         16        DO_ICALL                                                     
         17      > 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/L9Tqr
function name:  {closure:/in/L9Tqr:17}
number of ops:  15
compiled vars:  !0 = $a, !1 = $b, !2 = $idPriorities, !3 = $idOutlier
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   17     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        BIND_STATIC                                                  !2
          3        BIND_STATIC                                                  !3
          4        FETCH_DIM_R                                          ~4      !0, 'id'
          5        FETCH_DIM_IS                                         ~5      !2, ~4
          6        COALESCE                                             ~6      ~5
          7        QM_ASSIGN                                            ~6      !3
          8        FETCH_DIM_R                                          ~7      !1, 'id'
          9        FETCH_DIM_IS                                         ~8      !2, ~7
         10        COALESCE                                             ~9      ~8
         11        QM_ASSIGN                                            ~9      !3
         12        SPACESHIP                                            ~10     ~6, ~9
         13      > RETURN                                                       ~10
   18    14*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
173.5 ms | 2216 KiB | 16 Q