3v4l.org

run code in 300+ 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 = 9, Position 2 = 17
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 16
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KRBJb
function name:  {closure}
number of ops:  19
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        INIT_FCALL                                               'in_array'
          4        FETCH_DIM_R                                      ~3      !0, 'wonid'
          5        SEND_VAL                                                 ~3
          6        SEND_VAR                                                 !2
          7        DO_ICALL                                         $4      
          8      > JMPZ                                                     $4, ->17
   37     9    >   INIT_FCALL                                               'in_array'
         10        FETCH_DIM_R                                      ~5      !1, 'wonid'
         11        SEND_VAL                                                 ~5
         12        SEND_VAR                                                 !2
         13        DO_ICALL                                         $6      
         14      > JMPZ                                                     $6, ->16
   38    15    > > RETURN                                                   0
   39    16    > > RETURN                                                   1
   41    17    > > RETURN                                                   -1
   42    18*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.22 ms | 1014 KiB | 17 Q