3v4l.org

run code in 500+ PHP versions simultaneously
<?php // pole hráčov vytiahnuté z údajov zo servera $players = [ [ 'id'=>1, 'wonid' =>'s1', ], [ 'id'=>2, 'wonid' => 's2', ], [ 'id'=>3, 'wonid' => 's3', ], [ 'id'=>4, 'wonid' => 's4', ], [ 'id'=>5, 'wonid' => 's5', ], [ 'id'=>6, 'wonid' => 's6', ], ]; // administrátori $user_id = ['s2', 's3', 's6']; usort($players, function($left, $right) use($user_id) { if(in_array($left['wonid'], $user_id)) { if(in_array($right['wonid'], $user_id)) return 0; // both admins return 1; // left is admin } return -1; // right is admin }); print_r(array_reverse($players)); // ...?
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KRBJb
function name:  (null)
number of ops:  15
compiled vars:  !0 = $players, !1 = $user_id
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                       !0, <array>
   33     1        ASSIGN                                                       !1, <array>
   35     2        INIT_FCALL                                                   'usort'
          3        SEND_REF                                                     !0
          4        DECLARE_LAMBDA_FUNCTION                              ~4      [0]
          5        BIND_LEXICAL                                                 ~4, !1
   42     6        SEND_VAL                                                     ~4
   35     7        DO_ICALL                                                     
   44     8        INIT_FCALL                                                   'print_r'
          9        INIT_FCALL                                                   'array_reverse'
         10        SEND_VAR                                                     !0
         11        DO_ICALL                                             $6      
         12        SEND_VAR                                                     $6
         13        DO_ICALL                                                     
   46    14      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 11
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 10
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KRBJb
function name:  {closure:/in/KRBJb:35}
number of ops:  13
compiled vars:  !0 = $left, !1 = $right, !2 = $user_id
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   35     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        BIND_STATIC                                                  !2
   36     3        FETCH_DIM_R                                          ~3      !0, 'wonid'
          4        FRAMELESS_ICALL_2                in_array            ~4      ~3, !2
          5      > JMPZ                                                         ~4, ->11
   37     6    >   FETCH_DIM_R                                          ~5      !1, 'wonid'
          7        FRAMELESS_ICALL_2                in_array            ~6      ~5, !2
          8      > JMPZ                                                         ~6, ->10
   38     9    > > RETURN                                                       0
   39    10    > > RETURN                                                       1
   41    11    > > RETURN                                                       -1
   42    12*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
161.6 ms | 3064 KiB | 16 Q